home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1992-04-08 | 16.9 KB | [TEXT/KAHL] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Wed Apr 8 18:59:09 1992, modified Wed Apr 8 18:59:09 1992, creator Think C, type ASCII, 16202 bytes "ScrapTools.c" , at 0x3fca 852 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [KAHL] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 53 63 72 61 70 54 | 6f 6f 6c 73 2e 63 00 00 |..ScrapT|ools.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 3f 4a 00 | 00 03 54 a6 09 2b 3d a6 |.....?J.|..T..+=.|
|00000060| 09 2b 3d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.+=.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c2 57 00 00 |........|.....W..|
|00000080| 2f 2a 20 20 46 69 6c 65 | 3a 20 53 63 72 61 70 54 |/* File|: ScrapT|
|00000090| 6f 6f 6c 73 2e 63 20 2a | 2f 0d 0d 23 69 6e 63 6c |ools.c *|/..#incl|
|000000a0| 75 64 65 20 3c 41 70 70 | 6c 65 45 76 65 6e 74 73 |ude <App|leEvents|
|000000b0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 22 41 45 |.h>.#inc|lude "AE|
|000000c0| 52 65 67 69 73 74 72 79 | 2e 68 22 0d 23 69 6e 63 |Registry|.h".#inc|
|000000d0| 6c 75 64 65 20 22 41 45 | 4f 62 6a 65 63 74 73 2e |lude "AE|Objects.|
|000000e0| 68 22 0d 0d 23 69 6e 63 | 6c 75 64 65 20 22 53 63 |h"..#inc|lude "Sc|
|000000f0| 72 69 70 74 53 63 72 61 | 70 2e 68 22 0d 23 69 6e |riptScra|p.h".#in|
|00000100| 63 6c 75 64 65 20 22 50 | 72 6f 74 6f 74 79 70 65 |clude "P|rototype|
|00000110| 73 2e 68 22 0d 0d 0d 0d | 4f 53 45 72 72 20 5f 45 |s.h"....|OSErr _E|
|00000120| 6e 74 72 79 54 6f 53 63 | 72 61 70 49 6e 64 65 78 |ntryToSc|rapIndex|
|00000130| 28 73 68 6f 72 74 20 65 | 6e 74 72 79 4e 75 6d 2c |(short e|ntryNum,|
|00000140| 20 73 68 6f 72 74 20 2a | 73 63 72 61 70 49 6e 64 | short *|scrapInd|
|00000150| 65 78 2c 20 73 68 6f 72 | 74 20 2a 72 65 73 49 44 |ex, shor|t *resID|
|00000160| 29 0d 7b 0d 09 73 6d 61 | 70 48 61 6e 64 09 74 68 |).{..sma|pHand.th|
|00000170| 65 53 6d 61 70 3b 0d 09 | 73 68 6f 72 74 09 09 63 |eSmap;..|short..c|
|00000180| 6f 75 6e 74 2c 20 65 6e | 74 72 69 65 73 53 65 65 |ount, en|triesSee|
|00000190| 6e 3b 0d 09 4f 53 45 72 | 72 09 09 65 72 72 3b 0d |n;..OSEr|r..err;.|
|000001a0| 09 0d 09 2f 2a 20 54 68 | 65 20 73 63 72 61 70 62 |.../* Th|e scrapb|
|000001b0| 6f 6f 6b 20 6d 61 70 20 | 63 6f 6e 73 69 73 74 73 |ook map |consists|
|000001c0| 20 6f 66 20 61 6e 20 61 | 72 72 61 79 20 6f 66 20 | of an a|rray of |
|000001d0| 62 79 74 65 73 2c 20 77 | 68 65 72 65 20 74 68 65 |bytes, w|here the|
|000001e0| 20 76 61 6c 75 65 20 6f | 66 09 2a 2f 0d 09 2f 2a | value o|f.*/../*|
|000001f0| 20 65 61 63 68 20 62 79 | 74 65 20 69 73 20 65 69 | each by|te is ei|
|00000200| 74 68 65 72 20 30 20 28 | 65 6d 70 74 79 29 20 6f |ther 0 (|empty) o|
|00000210| 72 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |r the nu|mber of |
|00000220| 73 6f 6d 65 20 65 6e 74 | 72 79 20 69 6e 20 74 68 |some ent|ry in th|
|00000230| 65 09 09 2a 2f 0d 09 2f | 2a 20 73 63 72 61 70 62 |e..*/../|* scrapb|
|00000240| 6f 6f 6b 2e 20 28 66 6f | 72 20 65 78 61 6d 70 6c |ook. (fo|r exampl|
|00000250| 65 2c 20 74 68 65 20 53 | 4d 41 50 20 6d 69 67 68 |e, the S|MAP migh|
|00000260| 74 20 62 65 67 69 6e 20 | 77 69 74 68 20 22 5b 32 |t begin |with "[2|
|00000270| 2c 20 30 2c 20 31 2c 20 | 30 2c 20 c9 22 09 2a 2f |, 0, 1, |0, .".*/|
|00000280| 0d 09 2f 2a 20 77 68 69 | 63 68 20 69 6e 64 69 63 |../* whi|ch indic|
|00000290| 61 74 65 73 20 74 68 61 | 74 20 74 68 65 20 74 68 |ates tha|t the th|
|000002a0| 65 20 66 69 72 73 74 20 | 65 6e 74 72 79 20 69 6e |e first |entry in|
|000002b0| 20 74 68 65 20 53 4d 41 | 50 20 63 6f 72 72 65 73 | the SMA|P corres|
|000002c0| 70 6f 6e 64 73 20 09 2a | 2f 0d 09 2f 2a 20 77 69 |ponds .*|/../* wi|
|000002d0| 74 68 20 74 68 65 20 73 | 65 63 6f 6e 64 20 65 6e |th the s|econd en|
|000002e0| 74 72 79 20 69 6e 20 74 | 68 65 20 73 63 72 61 70 |try in t|he scrap|
|000002f0| 62 6f 6f 6b 2c 20 61 6e | 64 20 74 68 65 20 74 68 |book, an|d the th|
|00000300| 69 72 64 20 65 6e 74 72 | 79 20 69 6e 20 74 68 65 |ird entr|y in the|
|00000310| 20 09 2a 2f 0d 09 2f 2a | 20 53 4d 41 50 20 63 6f | .*/../*| SMAP co|
|00000320| 72 72 65 73 70 6f 6e 64 | 73 20 77 69 74 68 20 74 |rrespond|s with t|
|00000330| 68 65 20 66 69 72 73 74 | 20 65 6e 74 72 79 20 69 |he first| entry i|
|00000340| 6e 20 74 68 65 20 73 63 | 72 61 70 62 6f 6f 6b 2e |n the sc|rapbook.|
|00000350| 29 20 09 09 09 2a 2f 0d | 09 0d 09 2f 2a 20 46 75 |) ...*/.|.../* Fu|
|00000360| 72 74 68 65 72 6d 6f 72 | 65 2c 20 65 61 63 68 20 |rthermor|e, each |
|00000370| 65 6e 74 72 79 20 69 6e | 20 74 68 65 20 53 4d 41 |entry in| the SMA|
|00000380| 50 20 63 6f 72 72 65 73 | 70 6f 6e 64 73 20 77 69 |P corres|ponds wi|
|00000390| 74 68 20 74 68 65 20 72 | 65 73 6f 75 72 63 65 09 |th the r|esource.|
|000003a0| 2a 2f 0d 09 2f 2a 20 6e | 75 6d 62 65 72 20 66 6f |*/../* n|umber fo|
|000003b0| 72 20 74 68 65 20 69 74 | 65 6d 73 20 74 68 61 74 |r the it|ems that|
|000003c0| 20 63 6f 6d 70 72 69 73 | 65 20 74 68 61 74 20 65 | compris|e that e|
|000003d0| 6e 74 72 79 3a 20 53 4d | 41 50 5b 30 5d 20 3d 20 |ntry: SM|AP[0] = |
|000003e0| 72 65 73 6f 75 72 63 65 | 20 49 44 09 2a 2f 0d 09 |resource| ID.*/..|
|000003f0| 2f 2a 20 28 2d 33 32 37 | 36 38 29 2c 20 53 4d 41 |/* (-327|68), SMA|
|00000400| 50 5b 31 5d 20 3d 20 72 | 65 73 6f 75 72 63 65 28 |P[1] = r|esource(|
|00000410| 2d 33 32 37 36 37 29 2c | 20 53 4d 41 50 5b 32 5d |-32767),| SMAP[2]|
|00000420| 20 3d 20 72 65 73 6f 75 | 72 63 65 28 2d 33 32 37 | = resou|rce(-327|
|00000430| 36 36 29 2c 09 2a 2f 0d | 09 2f 2a 20 61 6e 64 20 |66),.*/.|./* and |
|00000440| 73 6f 20 6f 6e 2e 20 20 | 54 68 65 72 65 66 6f 72 |so on. |Therefor|
|00000450| 65 2c 20 77 65 20 63 61 | 6e 20 67 65 74 20 74 68 |e, we ca|n get th|
|00000460| 65 20 72 65 73 6f 75 72 | 63 65 20 49 44 20 66 6f |e resour|ce ID fo|
|00000470| 72 20 61 6e 20 69 74 65 | 6d 20 75 73 69 6e 67 09 |r an ite|m using.|
|00000480| 2a 2f 0d 09 2f 2a 20 74 | 68 65 20 66 6f 6c 6c 6f |*/../* t|he follo|
|00000490| 77 69 6e 67 20 61 6c 67 | 6f 72 69 74 68 6d 3a 09 |wing alg|orithm:.|
|000004a0| 09 09 09 09 09 09 09 09 | 09 09 09 2a 2f 0d 09 2f |........|...*/../|
|000004b0| 2a 20 31 29 20 53 63 61 | 6e 20 74 68 65 20 74 61 |* 1) Sca|n the ta|
|000004c0| 62 6c 65 20 74 6f 20 66 | 69 6e 64 20 74 68 65 20 |ble to f|ind the |
|000004d0| 65 6e 74 72 79 20 77 68 | 6f 73 65 20 76 61 6c 75 |entry wh|ose valu|
|000004e0| 65 20 3d 3d 20 65 6e 74 | 72 79 4e 75 6d 09 09 09 |e == ent|ryNum...|
|000004f0| 2a 2f 0d 09 2f 2a 20 32 | 29 20 72 65 73 49 44 20 |*/../* 2|) resID |
|00000500| 3d 3d 20 73 63 72 61 70 | 49 6e 64 65 78 20 2d 20 |== scrap|Index - |
|00000510| 33 32 37 36 38 09 09 09 | 09 09 09 09 09 09 09 2a |32768...|.......*|
|00000520| 2f 0d 09 0d 09 74 68 65 | 53 6d 61 70 20 3d 20 28 |/....the|Smap = (|
|00000530| 73 6d 61 70 48 61 6e 64 | 29 47 65 74 31 52 65 73 |smapHand|)Get1Res|
|00000540| 6f 75 72 63 65 28 27 53 | 4d 41 50 27 2c 20 30 29 |ource('S|MAP', 0)|
|00000550| 3b 0d 09 69 66 20 28 74 | 68 65 53 6d 61 70 20 3d |;..if (t|heSmap =|
|00000560| 3d 20 30 4c 29 20 72 65 | 74 75 72 6e 20 72 65 73 |= 0L) re|turn res|
|00000570| 4e 6f 74 46 6f 75 6e 64 | 3b 0d 09 69 66 20 28 28 |NotFound|;..if ((|
|00000580| 65 72 72 20 3d 20 52 65 | 73 45 72 72 6f 72 28 29 |err = Re|sError()|
|00000590| 29 20 21 3d 20 6e 6f 45 | 72 72 29 20 72 65 74 75 |) != noE|rr) retu|
|000005a0| 72 6e 20 65 72 72 3b 0d | 09 0d 09 2f 2a 20 43 6f |rn err;.|.../* Co|
|000005b0| 6e 76 65 72 74 20 74 68 | 65 20 65 6e 74 72 79 20 |nvert th|e entry |
|000005c0| 6e 75 6d 62 65 72 20 69 | 6e 74 6f 20 61 20 73 63 |number i|nto a sc|
|000005d0| 72 61 70 20 69 6e 64 65 | 78 20 2a 2f 0d 09 66 6f |rap inde|x */..fo|
|000005e0| 72 20 28 63 6f 75 6e 74 | 20 3d 20 30 3b 20 63 6f |r (count| = 0; co|
|000005f0| 75 6e 74 20 3c 3d 20 32 | 35 35 3b 20 63 6f 75 6e |unt <= 2|55; coun|
|00000600| 74 2b 2b 29 0d 09 09 69 | 66 20 28 28 2a 2a 74 68 |t++)...i|f ((**th|
|00000610| 65 53 6d 61 70 29 5b 63 | 6f 75 6e 74 5d 20 3d 3d |eSmap)[c|ount] ==|
|00000620| 20 65 6e 74 72 79 4e 75 | 6d 29 20 7b 0d 09 09 09 | entryNu|m) {....|
|00000630| 2f 2a 20 57 65 20 66 6f | 75 6e 64 20 69 74 20 2a |/* We fo|und it *|
|00000640| 2f 0d 09 09 09 2a 73 63 | 72 61 70 49 6e 64 65 78 |/....*sc|rapIndex|
|00000650| 20 3d 20 63 6f 75 6e 74 | 3b 0d 09 09 09 2a 72 65 | = count|;....*re|
|00000660| 73 49 44 20 3d 20 63 6f | 75 6e 74 20 2d 20 33 32 |sID = co|unt - 32|
|00000670| 37 36 38 4c 3b 0d 09 09 | 09 72 65 74 75 72 6e 20 |768L;...|.return |
|00000680| 6e 6f 45 72 72 3b 0d 09 | 09 7d 0d 09 0d 09 72 65 |noErr;..|.}....re|
|00000690| 74 75 72 6e 20 65 72 72 | 41 45 4e 6f 74 41 6e 45 |turn err|AENotAnE|
|000006a0| 6c 65 6d 65 6e 74 3b 09 | 2f 2a 20 49 66 20 77 65 |lement;.|/* If we|
|000006b0| 20 64 69 64 6e 27 74 20 | 66 69 6e 64 20 61 6e 79 | didn't |find any|
|000006c0| 74 68 69 6e 67 2c 20 65 | 78 69 74 20 2a 2f 0d 7d |thing, e|xit */.}|
|000006d0| 0d 0d 0d 4f 53 45 72 72 | 20 5f 47 65 74 31 53 63 |...OSErr| _Get1Sc|
|000006e0| 72 61 70 49 74 65 6d 28 | 73 68 6f 72 74 20 72 65 |rapItem(|short re|
|000006f0| 73 49 44 2c 20 4f 53 54 | 79 70 65 20 69 74 65 6d |sID, OST|ype item|
|00000700| 54 79 70 65 2c 20 41 45 | 44 65 73 63 20 2a 69 74 |Type, AE|Desc *it|
|00000710| 65 6d 29 0d 2f 2a 20 45 | 78 74 72 61 63 74 20 61 |em)./* E|xtract a|
|00000720| 6e 20 65 6e 74 72 79 20 | 66 72 6f 6d 20 74 68 65 |n entry |from the|
|00000730| 20 73 63 72 61 70 62 6f | 6f 6b 20 61 6e 64 20 70 | scrapbo|ok and p|
|00000740| 75 74 20 74 68 65 20 72 | 65 73 75 6c 74 20 69 6e |ut the r|esult in|
|00000750| 74 6f 20 61 6e 20 41 45 | 44 65 73 63 20 2a 2f 0d |to an AE|Desc */.|
|00000760| 2f 2a 20 77 68 6f 73 65 | 20 68 61 6e 64 6c 65 20 |/* whose| handle |
|00000770| 69 73 20 61 20 63 6f 70 | 79 20 6f 66 20 74 68 65 |is a cop|y of the|
|00000780| 20 72 65 73 6f 75 72 63 | 65 27 73 20 68 61 6e 64 | resourc|e's hand|
|00000790| 6c 65 20 61 6e 64 20 77 | 68 6f 73 65 20 74 79 70 |le and w|hose typ|
|000007a0| 65 20 3d 3d 20 74 68 65 | 20 2a 2f 0d 2f 2a 20 74 |e == the| */./* t|
|000007b0| 68 65 20 72 65 73 6f 75 | 72 63 65 27 73 20 74 79 |he resou|rce's ty|
|000007c0| 70 65 2e 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |pe......|........|
|000007d0| 20 2a 2f 0d 7b 0d 09 4f | 53 45 72 72 09 65 72 72 | */.{..O|SErr.err|
|000007e0| 3b 0d 09 0d 09 69 74 65 | 6d 2d 3e 64 61 74 61 48 |;....ite|m->dataH|
|000007f0| 61 6e 64 6c 65 20 3d 20 | 47 65 74 31 52 65 73 6f |andle = |Get1Reso|
|00000800| 75 72 63 65 28 69 74 65 | 6d 54 79 70 65 2c 20 72 |urce(ite|mType, r|
|00000810| 65 73 49 44 29 3b 0d 09 | 69 66 20 28 69 74 65 6d |esID);..|if (item|
|00000820| 2d 3e 64 61 74 61 48 61 | 6e 64 6c 65 20 3d 3d 20 |->dataHa|ndle == |
|00000830| 30 4c 29 20 72 65 74 75 | 72 6e 20 72 65 73 4e 6f |0L) retu|rn resNo|
|00000840| 74 46 6f 75 6e 64 3b 0d | 09 69 66 20 28 28 65 72 |tFound;.|.if ((er|
|00000850| 72 20 3d 20 52 65 73 45 | 72 72 6f 72 28 29 29 20 |r = ResE|rror()) |
|00000860| 21 3d 20 6e 6f 45 72 72 | 29 20 72 65 74 75 72 6e |!= noErr|) return|
|00000870| 20 65 72 72 3b 0d 09 69 | 74 65 6d 2d 3e 64 65 73 | err;..i|tem->des|
|00000880| 63 72 69 70 74 6f 72 54 | 79 70 65 20 3d 20 69 74 |criptorT|ype = it|
|00000890| 65 6d 54 79 70 65 3b 0d | 09 48 61 6e 64 54 6f 48 |emType;.|.HandToH|
|000008a0| 61 6e 64 28 26 69 74 65 | 6d 2d 3e 64 61 74 61 48 |and(&ite|m->dataH|
|000008b0| 61 6e 64 6c 65 29 3b 09 | 09 2f 2a 20 43 6f 70 79 |andle);.|./* Copy|
|000008c0| 20 74 68 65 20 68 61 6e | 64 6c 65 20 73 6f 20 77 | the han|dle so w|
|000008d0| 65 20 63 61 6e 20 63 6c | 6f 73 65 20 74 68 65 20 |e can cl|ose the |
|000008e0| 72 65 73 6f 75 72 63 65 | 20 2a 2f 0d 09 09 09 09 |resource| */.....|
|000008f0| 09 09 09 09 09 09 2f 2a | 20 66 69 6c 65 20 6f 72 |....../*| file or|
|00000900| 20 64 69 73 70 6f 73 65 | 20 6f 66 20 74 68 65 20 | dispose| of the |
|00000910| 41 45 44 65 73 63 20 77 | 69 74 68 6f 75 74 20 61 |AEDesc w|ithout a|
|00000920| 20 70 72 6f 62 6c 65 6d | 2e 09 2a 2f 0d 09 69 66 | problem|..*/..if|
|00000930| 20 28 28 65 72 72 20 3d | 20 4d 65 6d 45 72 72 6f | ((err =| MemErro|
|00000940| 72 28 29 29 20 21 3d 20 | 6e 6f 45 72 72 29 20 7b |r()) != |noErr) {|
|00000950| 0d 09 09 44 69 73 70 6f | 73 48 61 6e 64 6c 65 28 |...Dispo|sHandle(|
|00000960| 69 74 65 6d 2d 3e 64 61 | 74 61 48 61 6e 64 6c 65 |item->da|taHandle|
|00000970| 29 3b 0d 09 09 69 74 65 | 6d 2d 3e 64 61 74 61 48 |);...ite|m->dataH|
|00000980| 61 6e 64 6c 65 20 3d 20 | 30 4c 3b 0d 09 7d 0d 09 |andle = |0L;..}..|
|00000990| 72 65 74 75 72 6e 20 65 | 72 72 3b 0d 7d 20 2f 2a |return e|rr;.} /*|
|000009a0| 20 5f 47 65 74 31 53 63 | 72 61 70 49 74 65 6d 20 | _Get1Sc|rapItem |
|000009b0| 2a 2f 0d 0d 0d 4f 53 45 | 72 72 20 43 6f 75 6e 74 |*/...OSE|rr Count|
|000009c0| 53 63 72 61 70 62 6f 6f | 6b 45 6e 74 72 69 65 73 |Scrapboo|kEntries|
|000009d0| 28 73 68 6f 72 74 20 2a | 63 6f 75 6e 74 29 0d 7b |(short *|count).{|
|000009e0| 0d 09 73 6d 61 70 48 61 | 6e 64 09 74 68 65 53 6d |..smapHa|nd.theSm|
|000009f0| 61 70 3b 0d 09 63 68 61 | 72 09 09 2a 65 6e 74 72 |ap;..cha|r..*entr|
|00000a00| 79 50 74 72 3b 0d 09 4f | 53 45 72 72 09 09 65 72 |yPtr;..O|SErr..er|
|00000a10| 72 3b 0d 09 73 68 6f 72 | 74 09 09 69 6e 64 65 78 |r;..shor|t..index|
|00000a20| 3b 0d 09 0d 09 2a 63 6f | 75 6e 74 20 3d 20 30 3b |;....*co|unt = 0;|
|00000a30| 0d 09 0d 09 74 68 65 53 | 6d 61 70 20 3d 20 28 73 |....theS|map = (s|
|00000a40| 6d 61 70 48 61 6e 64 29 | 47 65 74 31 52 65 73 6f |mapHand)|Get1Reso|
|00000a50| 75 72 63 65 28 27 53 4d | 41 50 27 2c 20 30 29 3b |urce('SM|AP', 0);|
|00000a60| 09 2f 2a 20 54 68 65 20 | 53 4d 41 50 20 69 73 20 |./* The |SMAP is |
|00000a70| 74 68 65 20 69 6e 64 65 | 78 20 74 6f 20 74 68 65 |the inde|x to the|
|00000a80| 20 72 65 73 6f 75 72 63 | 65 73 20 09 2a 2f 0d 09 | resourc|es .*/..|
|00000a90| 69 66 20 28 74 68 65 53 | 6d 61 70 20 3d 3d 20 30 |if (theS|map == 0|
|00000aa0| 4c 29 20 72 65 74 75 72 | 6e 20 72 65 73 4e 6f 74 |L) retur|n resNot|
|00000ab0| 46 6f 75 6e 64 3b 09 09 | 09 2f 2a 20 63 6f 6e 74 |Found;..|./* cont|
|00000ac0| 61 69 6e 65 64 20 77 69 | 74 68 69 6e 20 74 68 65 |ained wi|thin the|
|00000ad0| 20 73 63 72 61 70 62 6f | 6f 6b 20 66 69 6c 65 2e | scrapbo|ok file.|
|00000ae0| 20 09 2a 2f 0d 09 69 66 | 20 28 28 65 72 72 20 3d | .*/..if| ((err =|
|00000af0| 20 52 65 73 45 72 72 6f | 72 28 29 29 20 21 3d 20 | ResErro|r()) != |
|00000b00| 6e 6f 45 72 72 29 20 72 | 65 74 75 72 6e 20 65 72 |noErr) r|eturn er|
|00000b10| 72 3b 0d 09 0d 09 2f 2a | 20 43 6f 75 6e 74 20 74 |r;..../*| Count t|
|00000b20| 68 65 20 65 6e 74 72 69 | 65 73 20 2a 2f 0d 09 66 |he entri|es */..f|
|00000b30| 6f 72 20 28 65 6e 74 72 | 79 50 74 72 20 3d 20 28 |or (entr|yPtr = (|
|00000b40| 63 68 61 72 2a 29 2a 74 | 68 65 53 6d 61 70 2c 20 |char*)*t|heSmap, |
|00000b50| 69 6e 64 65 78 20 3d 20 | 30 3b 20 69 6e 64 65 78 |index = |0; index|
|00000b60| 20 3c 3d 20 32 35 35 3b | 20 69 6e 64 65 78 2b 2b | <= 255;| index++|
|00000b70| 2c 20 65 6e 74 72 79 50 | 74 72 2b 2b 29 0d 09 09 |, entryP|tr++)...|
|00000b80| 69 66 20 28 2a 65 6e 74 | 72 79 50 74 72 20 21 3d |if (*ent|ryPtr !=|
|00000b90| 20 27 5c 30 27 29 20 28 | 2a 63 6f 75 6e 74 29 2b | '\0') (|*count)+|
|00000ba0| 2b 3b 0d 09 0d 09 72 65 | 74 75 72 6e 20 6e 6f 45 |+;....re|turn noE|
|00000bb0| 72 72 3b 0d 7d 0d 0d 0d | 4f 53 45 72 72 20 47 65 |rr;.}...|OSErr Ge|
|00000bc0| 74 31 53 63 72 61 70 62 | 6f 6f 6b 49 74 65 6d 20 |t1Scrapb|ookItem |
|00000bd0| 28 73 68 6f 72 74 20 65 | 6e 74 72 79 49 6e 64 65 |(short e|ntryInde|
|00000be0| 78 2c 20 52 65 73 54 79 | 70 65 20 69 74 65 6d 54 |x, ResTy|pe itemT|
|00000bf0| 79 70 65 2c 20 41 45 44 | 65 73 63 20 2a 69 74 65 |ype, AED|esc *ite|
|00000c00| 6d 29 0d 7b 0d 09 2f 2a | 20 54 68 69 73 20 72 6f |m).{../*| This ro|
|00000c10| 75 74 69 6e 65 20 65 78 | 74 72 61 63 74 73 20 61 |utine ex|tracts a|
|00000c20| 6c 6c 20 6f 66 20 74 68 | 65 20 69 74 65 6d 73 20 |ll of th|e items |
|00000c30| 6f 66 20 61 20 67 69 76 | 65 6e 20 74 79 70 65 20 |of a giv|en type |
|00000c40| 66 72 6f 6d 20 61 20 73 | 63 72 61 70 62 6f 6f 6b |from a s|crapbook|
|00000c50| 09 2a 2f 0d 09 2f 2a 20 | 65 6e 74 72 79 2e 20 49 |.*/../* |entry. I|
|00000c60| 66 20 69 74 65 6d 54 79 | 70 65 20 3d 20 74 79 70 |f itemTy|pe = typ|
|00000c70| 65 57 69 6c 64 43 61 72 | 64 20 74 68 65 6e 20 61 |eWildCar|d then a|
|00000c80| 6c 6c 20 6f 66 20 74 68 | 65 20 69 74 65 6d 73 20 |ll of th|e items |
|00000c90| 61 72 65 20 65 78 74 72 | 61 63 74 65 64 20 26 20 |are extr|acted & |
|00000ca0| 09 2a 2f 0d 09 2f 2a 20 | 6d 61 64 65 20 69 6e 74 |.*/../* |made int|
|00000cb0| 6f 20 61 20 6c 69 73 74 | 2e 20 09 09 09 09 09 09 |o a list|. ......|
|00000cc0| 09 09 09 09 09 09 09 09 | 2a 2f 0d 09 2f 2a 20 54 |........|*/../* T|
|00000cd0| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 73 74 6f 70 |his rout|ine stop|
|00000ce0| 73 20 69 66 20 61 6e 20 | 65 72 72 6f 72 20 6f 63 |s if an |error oc|
|00000cf0| 63 75 72 73 20 61 6e 64 | 20 72 65 74 75 72 6e 73 |curs and| returns|
|00000d00| 20 61 6c 6c 20 6f 66 20 | 74 68 65 20 65 6e 74 72 | all of |the entr|
|00000d10| 69 65 73 20 09 2a 2f 0d | 09 2f 2a 20 63 6f 6c 6c |ies .*/.|./* coll|
|00000d20| 65 63 74 65 64 20 74 6f | 20 74 68 61 74 20 70 6f |ected to| that po|
|00000d30| 69 6e 74 2e 09 09 09 09 | 09 09 09 09 09 09 09 09 |int.....|........|
|00000d40| 09 2a 2f 0d 09 0d 09 41 | 45 44 65 73 63 09 09 6f |.*/....A|EDesc..o|
|00000d50| 6e 65 44 65 73 63 3b 0d | 09 52 65 73 54 79 70 65 |neDesc;.|.ResType|
|00000d60| 09 09 6f 6e 65 54 79 70 | 65 3b 0d 09 73 68 6f 72 |..oneTyp|e;..shor|
|00000d70| 74 09 09 72 65 73 49 44 | 2c 20 73 6d 61 70 49 6e |t..resID|, smapIn|
|00000d80| 64 65 78 2c 20 6e 75 6d | 54 79 70 65 73 2c 20 74 |dex, num|Types, t|
|00000d90| 79 70 65 49 6e 64 65 78 | 2c 20 6c 69 73 74 49 6e |ypeIndex|, listIn|
|00000da0| 64 65 78 3b 0d 09 4f 53 | 45 72 72 09 09 65 72 72 |dex;..OS|Err..err|
|00000db0| 3b 0d 09 09 0d 09 2f 2a | 20 49 6e 69 74 69 61 6c |;...../*| Initial|
|00000dc0| 69 7a 65 20 74 68 65 20 | 72 65 74 75 72 6e 65 64 |ize the |returned|
|00000dd0| 20 69 74 65 6d 2c 20 69 | 6e 20 63 61 73 65 20 61 | item, i|n case a|
|00000de0| 6e 20 65 72 72 6f 72 20 | 6f 63 63 75 72 73 20 2a |n error |occurs *|
|00000df0| 2f 0d 09 69 74 65 6d 2d | 3e 64 61 74 61 48 61 6e |/..item-|>dataHan|
|00000e00| 64 6c 65 20 3d 20 30 4c | 3b 0d 09 69 74 65 6d 2d |dle = 0L|;..item-|
|00000e10| 3e 64 65 73 63 72 69 70 | 74 6f 72 54 79 70 65 20 |>descrip|torType |
|00000e20| 3d 20 27 20 20 20 20 27 | 3b 0d 09 0d 09 65 72 72 |= ' '|;....err|
|00000e30| 20 3d 20 5f 45 6e 74 72 | 79 54 6f 53 63 72 61 70 | = _Entr|yToScrap|
|00000e40| 49 6e 64 65 78 28 65 6e | 74 72 79 49 6e 64 65 78 |Index(en|tryIndex|
|00000e50| 2c 20 26 73 6d 61 70 49 | 6e 64 65 78 2c 20 26 72 |, &smapI|ndex, &r|
|00000e60| 65 73 49 44 29 3b 0d 09 | 69 66 20 28 65 72 72 20 |esID);..|if (err |
|00000e70| 21 3d 20 6e 6f 45 72 72 | 29 20 72 65 74 75 72 6e |!= noErr|) return|
|00000e80| 20 65 72 72 3b 0d 0d 09 | 2f 2a 20 49 66 20 77 65 | err;...|/* If we|
|00000e90| 27 76 65 20 62 65 65 6e | 20 61 73 6b 65 64 20 66 |'ve been| asked f|
|00000ea0| 6f 72 20 61 20 73 70 65 | 63 69 66 69 63 20 74 79 |or a spe|cific ty|
|00000eb0| 70 65 2c 20 6c 6f 6f 6b | 20 66 6f 72 20 69 74 20 |pe, look| for it |
|00000ec0| 2a 2f 0d 09 69 66 20 28 | 69 74 65 6d 54 79 70 65 |*/..if (|itemType|
|00000ed0| 20 21 3d 20 74 79 70 65 | 57 69 6c 64 43 61 72 64 | != type|WildCard|
|00000ee0| 29 0d 09 09 72 65 74 75 | 72 6e 20 5f 47 65 74 31 |)...retu|rn _Get1|
|00000ef0| 53 63 72 61 70 49 74 65 | 6d 28 72 65 73 49 44 2c |ScrapIte|m(resID,|
|00000f00| 20 69 74 65 6d 54 79 70 | 65 2c 20 69 74 65 6d 29 | itemTyp|e, item)|
|00000f10| 3b 0d 09 65 6c 73 65 20 | 7b 0d 09 09 2f 2a 20 54 |;..else |{.../* T|
|00000f20| 68 65 20 75 73 65 72 20 | 61 73 6b 65 64 20 66 6f |he user |asked fo|
|00000f30| 72 20 65 76 65 72 79 74 | 68 69 6e 67 20 69 6e 20 |r everyt|hing in |
|00000f40| 74 68 69 73 20 69 74 65 | 6d 2c 20 73 6f 20 77 65 |this ite|m, so we|
|00000f50| 27 6c 6c 20 6c 6f 6f 6b | 20 74 68 72 6f 75 67 68 |'ll look| through|
|00000f60| 20 61 6c 6c 20 2a 2f 0d | 09 09 2f 2a 20 61 76 61 | all */.|../* ava|
|00000f70| 69 6c 61 62 6c 65 20 74 | 79 70 65 73 20 66 6f 72 |ilable t|ypes for|
|00000f80| 20 69 74 65 6d 73 20 77 | 69 74 68 20 74 68 69 73 | items w|ith this|
|00000f90| 20 72 65 73 6f 75 72 63 | 65 20 6e 75 6d 62 65 72 | resourc|e number|
|00000fa0| 2e 09 09 09 09 09 20 2a | 2f 0d 09 09 2f 2a 20 57 |...... *|/.../* W|
|00000fb0| 65 20 68 61 76 65 20 74 | 6f 20 64 6f 20 74 68 69 |e have t|o do thi|
|00000fc0| 73 20 62 65 63 61 75 73 | 65 20 74 68 65 20 73 63 |s becaus|e the sc|
|00000fd0| 72 61 70 62 6f 6f 6b 20 | 6d 61 70 20 67 69 76 65 |rapbook |map give|
|00000fe0| 73 20 6e 6f 20 69 6e 64 | 69 63 61 74 69 6f 6e 20 |s no ind|ication |
|00000ff0| 61 73 20 09 20 2a 2f 0d | 09 09 2f 2a 20 74 6f 20 |as . */.|../* to |
|00001000| 77 68 69 63 68 20 72 65 | 73 6f 75 72 63 65 20 74 |which re|source t|
|00001010| 79 70 65 73 20 61 72 65 | 20 63 6f 6e 74 61 69 6e |ypes are| contain|
|00001020| 65 64 20 69 6e 20 61 20 | 67 69 76 65 6e 20 73 63 |ed in a |given sc|
|00001030| 72 61 70 62 6f 6f 6b 20 | 65 6e 74 72 79 2e 09 20 |rapbook |entry.. |
|00001040| 2a 2f 0d 09 09 6e 75 6d | 54 79 70 65 73 20 3d 20 |*/...num|Types = |
|00001050| 43 6f 75 6e 74 54 79 70 | 65 73 28 29 3b 0d 09 09 |CountTyp|es();...|
|00001060| 66 6f 72 20 28 74 79 70 | 65 49 6e 64 65 78 20 3d |for (typ|eIndex =|
|00001070| 20 31 2c 20 6c 69 73 74 | 49 6e 64 65 78 20 3d 20 | 1, list|Index = |
|00001080| 31 3b 20 74 79 70 65 49 | 6e 64 65 78 20 3c 3d 20 |1; typeI|ndex <= |
|00001090| 6e 75 6d 54 79 70 65 73 | 3b 20 74 79 70 65 49 6e |numTypes|; typeIn|
|000010a0| 64 65 78 2b 2b 29 20 7b | 0d 09 09 09 47 65 74 31 |dex++) {|....Get1|
|000010b0| 49 6e 64 54 79 70 65 28 | 26 6f 6e 65 54 79 70 65 |IndType(|&oneType|
|000010c0| 2c 20 74 79 70 65 49 6e | 64 65 78 29 3b 0d 09 09 |, typeIn|dex);...|
|000010d0| 09 69 66 20 28 28 65 72 | 72 20 3d 20 52 65 73 45 |.if ((er|r = ResE|
|000010e0| 72 72 6f 72 28 29 29 20 | 21 3d 20 6e 6f 45 72 72 |rror()) |!= noErr|
|000010f0| 29 20 72 65 74 75 72 6e | 20 65 72 72 3b 0d 09 09 |) return| err;...|
|00001100| 09 65 72 72 20 3d 20 5f | 47 65 74 31 53 63 72 61 |.err = _|Get1Scra|
|00001110| 70 49 74 65 6d 28 72 65 | 73 49 44 2c 20 6f 6e 65 |pItem(re|sID, one|
|00001120| 54 79 70 65 2c 20 26 6f | 6e 65 44 65 73 63 29 3b |Type, &o|neDesc);|
|00001130| 0d 09 09 09 69 66 20 28 | 65 72 72 20 3d 3d 20 6e |....if (|err == n|
|00001140| 6f 45 72 72 29 20 7b 0d | 09 09 09 09 2f 2a 20 57 |oErr) {.|..../* W|
|00001150| 65 20 68 61 76 65 20 61 | 6e 20 69 74 65 6d 20 69 |e have a|n item i|
|00001160| 6e 20 6f 6e 65 44 65 73 | 63 2c 20 73 6f 20 61 64 |n oneDes|c, so ad|
|00001170| 64 20 69 74 20 74 6f 20 | 74 68 65 20 6c 69 73 74 |d it to |the list|
|00001180| 20 2a 2f 0d 09 09 09 09 | 69 66 20 28 69 74 65 6d | */.....|if (item|
|00001190| 2d 3e 64 61 74 61 48 61 | 6e 64 6c 65 20 3d 3d 20 |->dataHa|ndle == |
|000011a0| 30 4c 29 20 7b 0d 09 09 | 09 09 09 2f 2a 20 42 75 |0L) {...|.../* Bu|
|000011b0| 74 20 66 69 72 73 74 2c | 20 63 72 65 61 74 65 20 |t first,| create |
|000011c0| 74 68 65 20 6c 69 73 74 | 20 69 66 20 69 74 20 64 |the list| if it d|
|000011d0| 6f 65 73 6e 27 74 20 65 | 78 69 73 74 20 2a 2f 0d |oesn't e|xist */.|
|000011e0| 09 09 09 09 09 65 72 72 | 20 3d 20 41 45 43 72 65 |.....err| = AECre|
|000011f0| 61 74 65 4c 69 73 74 28 | 30 4c 2c 20 30 2c 20 74 |ateList(|0L, 0, t|
|00001200| 72 75 65 20 2f 2a 20 69 | 73 52 65 63 6f 72 64 20 |rue /* i|sRecord |
|00001210| 2a 2f 2c 20 69 74 65 6d | 29 3b 0d 09 09 20 09 09 |*/, item|);... ..|
|00001220| 09 69 66 20 28 65 72 72 | 20 21 3d 20 6e 6f 45 72 |.if (err| != noEr|
|00001230| 72 29 20 72 65 74 75 72 | 6e 20 65 72 72 3b 0d 09 |r) retur|n err;..|
|00001240| 09 09 09 7d 0d 09 09 09 | 09 44 65 62 75 67 67 65 |...}....|.Debugge|
|00001250| 72 28 29 3b 0d 09 09 09 | 09 65 72 72 20 3d 20 41 |r();....|.err = A|
|00001260| 45 50 75 74 44 65 73 63 | 28 69 74 65 6d 2c 20 6c |EPutDesc|(item, l|
|00001270| 69 73 74 49 6e 64 65 78 | 2c 20 26 6f 6e 65 44 65 |istIndex|, &oneDe|
|00001280| 73 63 29 3b 0d 09 09 09 | 09 6c 69 73 74 49 6e 64 |sc);....|.listInd|
|00001290| 65 78 2b 2b 3b 0d 09 09 | 09 09 28 76 6f 69 64 29 |ex++;...|..(void)|
|000012a0| 20 41 45 44 69 73 70 6f | 73 65 44 65 73 63 28 26 | AEDispo|seDesc(&|
|000012b0| 6f 6e 65 44 65 73 63 29 | 3b 09 09 09 2f 2a 20 47 |oneDesc)|;.../* G|
|000012c0| 65 74 20 72 69 64 20 6f | 66 20 74 68 65 20 73 69 |et rid o|f the si|
|000012d0| 6e 67 6c 65 20 65 6e 74 | 72 79 20 77 68 65 74 68 |ngle ent|ry wheth|
|000012e0| 65 72 20 2a 2f 0d 09 09 | 09 09 09 09 09 09 09 09 |er */...|........|
|000012f0| 09 09 09 09 2f 2a 20 74 | 68 65 72 65 20 77 61 73 |..../* t|here was|
|00001300| 20 61 6e 20 65 72 72 6f | 72 20 69 6e 20 41 45 50 | an erro|r in AEP|
|00001310| 75 74 44 65 73 63 20 6f | 72 20 6e 6f 74 20 2a 2f |utDesc o|r not */|
|00001320| 0d 09 09 09 09 69 66 20 | 28 65 72 72 20 21 3d 20 |.....if |(err != |
|00001330| 6e 6f 45 72 72 29 20 72 | 65 74 75 72 6e 20 65 72 |noErr) r|eturn er|
|00001340| 72 3b 0d 09 09 09 7d 0d | 09 09 09 2f 2a 20 49 67 |r;....}.|.../* Ig|
|00001350| 6e 6f 72 65 20 22 72 65 | 73 4e 6f 74 46 6f 75 6e |nore "re|sNotFoun|
|00001360| 64 22 20 65 72 72 6f 72 | 73 2c 20 73 69 6e 63 65 |d" error|s, since|
|00001370| 20 77 65 20 61 72 65 20 | 6c 69 6b 65 6c 79 20 74 | we are |likely t|
|00001380| 6f 20 67 65 74 20 71 75 | 69 74 65 20 61 20 66 65 |o get qu|ite a fe|
|00001390| 77 20 2a 2f 0d 09 09 09 | 2f 2a 20 6f 66 20 74 68 |w */....|/* of th|
|000013a0| 65 6d 20 61 73 20 77 65 | 20 74 72 79 20 61 6e 64 |em as we| try and|
|000013b0| 20 66 69 6e 64 20 74 68 | 65 20 72 65 73 6f 75 72 | find th|e resour|
|000013c0| 63 65 73 20 66 6f 72 20 | 74 68 69 73 20 6f 6e 65 |ces for |this one|
|000013d0| 20 65 6e 74 72 79 20 2a | 2f 0d 09 09 09 69 66 20 | entry *|/....if |
|000013e0| 28 28 65 72 72 20 21 3d | 20 6e 6f 45 72 72 29 20 |((err !=| noErr) |
|000013f0| 26 26 20 28 65 72 72 20 | 21 3d 20 72 65 73 4e 6f |&& (err |!= resNo|
|00001400| 74 46 6f 75 6e 64 29 29 | 20 72 65 74 75 72 6e 20 |tFound))| return |
|00001410| 65 72 72 3b 0d 09 09 7d | 0d 09 7d 0d 09 72 65 74 |err;...}|..}..ret|
|00001420| 75 72 6e 20 6e 6f 45 72 | 72 3b 0d 7d 09 2f 2a 20 |urn noEr|r;.}./* |
|00001430| 47 65 74 31 53 63 72 61 | 70 62 6f 6f 6b 45 6e 74 |Get1Scra|pbookEnt|
|00001440| 72 79 20 2a 2f 0d 0d 0d | 4f 53 45 72 72 20 50 75 |ry */...|OSErr Pu|
|00001450| 74 31 53 63 72 61 70 62 | 6f 6f 6b 49 74 65 6d 20 |t1Scrapb|ookItem |
|00001460| 28 73 68 6f 72 74 20 65 | 6e 74 72 79 49 6e 64 65 |(short e|ntryInde|
|00001470| 78 2c 20 63 6f 6e 73 74 | 20 41 45 44 65 73 63 20 |x, const| AEDesc |
|00001480| 2a 65 6e 74 72 79 43 6f | 6e 74 65 6e 74 73 29 0d |*entryCo|ntents).|
|00001490| 7b 0d 09 2f 2a 20 54 68 | 69 73 20 72 6f 75 74 69 |{../* Th|is routi|
|000014a0| 6e 65 20 74 61 6b 65 73 | 20 6f 6e 65 20 6f 72 20 |ne takes| one or |
|000014b0| 6d 6f 72 65 20 72 65 73 | 6f 75 72 63 65 73 20 28 |more res|ources (|
|000014c0| 70 61 63 6b 61 67 65 64 | 20 61 73 20 41 45 44 65 |packaged| as AEDe|
|000014d0| 73 63 73 20 77 69 74 68 | 20 74 68 65 20 2a 2f 0d |scs with| the */.|
|000014e0| 09 2f 2a 20 72 65 73 6f | 75 72 63 65 20 74 79 70 |./* reso|urce typ|
|000014f0| 65 20 69 6e 20 74 68 65 | 20 64 65 73 63 72 69 70 |e in the| descrip|
|00001500| 74 6f 72 54 79 70 65 20 | 66 69 65 6c 64 20 61 6e |torType |field an|
|00001510| 64 20 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 68 |d the re|source h|
|00001520| 61 6e 64 6c 65 73 20 69 | 6e 20 20 2a 2f 0d 09 2f |andles i|n */../|
|00001530| 2a 20 74 68 65 20 64 61 | 74 61 48 61 6e 64 6c 65 |* the da|taHandle|
|00001540| 20 66 69 65 6c 64 29 20 | 61 6e 64 20 6d 65 72 67 | field) |and merg|
|00001550| 65 73 20 74 68 65 6d 20 | 69 6e 74 6f 20 74 68 65 |es them |into the|
|00001560| 20 73 70 65 63 69 66 69 | 65 64 20 65 6e 74 72 79 | specifi|ed entry|
|00001570| 2e 09 09 20 20 2a 2f 0d | 09 0d 09 4f 53 45 72 72 |... */.|...OSErr|
|00001580| 09 09 65 72 72 3b 0d 09 | 73 68 6f 72 74 09 09 73 |..err;..|short..s|
|00001590| 63 72 61 70 49 6e 64 65 | 78 2c 20 6c 69 73 74 49 |crapInde|x, listI|
|000015a0| 6e 64 65 78 2c 20 72 65 | 73 49 44 3b 0d 09 48 61 |ndex, re|sID;..Ha|
|000015b0| 6e 64 6c 65 09 09 72 65 | 73 48 61 6e 64 6c 65 3b |ndle..re|sHandle;|
|000015c0| 0d 09 6c 6f 6e 67 09 09 | 69 74 65 6d 43 6f 75 6e |..long..|itemCoun|
|000015d0| 74 3b 0d 09 41 45 44 65 | 73 63 09 09 69 74 65 6d |t;..AEDe|sc..item|
|000015e0| 44 65 73 63 3b 0d 09 41 | 45 4b 65 79 77 6f 72 64 |Desc;..A|EKeyword|
|000015f0| 09 69 74 65 6d 4b 65 79 | 77 6f 72 64 3b 0d 09 73 |.itemKey|word;..s|
|00001600| 6d 61 70 48 61 6e 64 09 | 74 68 65 53 6d 61 70 3b |mapHand.|theSmap;|
|00001610| 0d 09 63 68 61 72 09 09 | 2a 73 63 72 61 70 62 6f |..char..|*scrapbo|
|00001620| 6f 6b 4d 61 70 3b 0d 09 | 41 45 44 65 73 63 4c 69 |okMap;..|AEDescLi|
|00001630| 73 74 09 65 6e 74 72 79 | 4c 69 73 74 20 3d 20 7b |st.entry|List = {|
|00001640| 74 79 70 65 4e 75 6c 6c | 2c 20 4e 55 4c 4c 7d 3b |typeNull|, NULL};|
|00001650| 0d 09 0d 09 2f 2a 20 47 | 65 74 20 74 68 65 20 72 |..../* G|et the r|
|00001660| 65 73 6f 75 72 63 65 20 | 6e 75 6d 62 65 72 20 66 |esource |number f|
|00001670| 6f 72 20 74 68 69 73 20 | 73 63 72 61 70 62 6f 6f |or this |scrapboo|
|00001680| 6b 20 65 6e 74 72 79 20 | 2a 2f 0d 09 65 72 72 20 |k entry |*/..err |
|00001690| 3d 20 5f 45 6e 74 72 79 | 54 6f 53 63 72 61 70 49 |= _Entry|ToScrapI|
|000016a0| 6e 64 65 78 28 65 6e 74 | 72 79 49 6e 64 65 78 2c |ndex(ent|ryIndex,|
|000016b0| 20 26 73 63 72 61 70 49 | 6e 64 65 78 2c 20 26 72 | &scrapI|ndex, &r|
|000016c0| 65 73 49 44 29 3b 0d 09 | 69 66 20 28 65 72 72 29 |esID);..|if (err)|
|000016d0| 20 67 6f 74 6f 20 64 6f | 6e 65 3b 0d 09 0d 09 2f | goto do|ne;..../|
|000016e0| 2a 20 4d 61 6b 65 20 73 | 75 72 65 20 74 68 61 74 |* Make s|ure that|
|000016f0| 20 77 65 20 68 61 76 65 | 20 61 20 6c 69 73 74 20 | we have| a list |
|00001700| 6f 66 20 69 74 65 6d 73 | 20 28 73 69 6e 63 65 20 |of items| (since |
|00001710| 74 68 69 73 20 72 6f 75 | 74 69 6e 65 20 63 61 6e |this rou|tine can|
|00001720| 20 74 61 6b 65 20 65 69 | 74 68 65 72 20 2a 2f 0d | take ei|ther */.|
|00001730| 09 2f 2a 20 61 20 73 69 | 6e 67 6c 65 20 69 74 65 |./* a si|ngle ite|
|00001740| 6d 20 6f 72 20 61 20 6c | 69 73 74 2e 09 09 09 09 |m or a l|ist.....|
|00001750| 09 09 09 09 09 09 09 09 | 09 20 20 2a 2f 0d 09 65 |........|. */..e|
|00001760| 72 72 20 3d 20 41 45 43 | 6f 65 72 63 65 44 65 73 |rr = AEC|oerceDes|
|00001770| 63 28 65 6e 74 72 79 43 | 6f 6e 74 65 6e 74 73 2c |c(entryC|ontents,|
|00001780| 20 74 79 70 65 41 45 4c | 69 73 74 2c 20 26 65 6e | typeAEL|ist, &en|
|00001790| 74 72 79 4c 69 73 74 29 | 3b 0d 09 69 66 20 28 65 |tryList)|;..if (e|
|000017a0| 72 72 20 21 3d 20 6e 6f | 45 72 72 29 20 67 6f 74 |rr != no|Err) got|
|000017b0| 6f 20 64 6f 6e 65 3b 0d | 09 0d 09 2f 2a 20 31 2e |o done;.|.../* 1.|
|000017c0| 20 46 69 6e 64 20 6f 75 | 74 20 68 6f 77 20 6d 61 | Find ou|t how ma|
|000017d0| 6e 79 20 69 74 65 6d 73 | 20 77 65 20 6e 65 65 64 |ny items| we need|
|000017e0| 20 74 6f 20 69 6e 73 65 | 72 74 20 69 6e 74 6f 20 | to inse|rt into |
|000017f0| 74 68 69 73 20 65 6e 74 | 72 79 20 2a 2f 0d 09 65 |this ent|ry */..e|
|00001800| 72 72 20 3d 20 41 45 43 | 6f 75 6e 74 49 74 65 6d |rr = AEC|ountItem|
|00001810| 73 28 26 65 6e 74 72 79 | 4c 69 73 74 2c 20 26 69 |s(&entry|List, &i|
|00001820| 74 65 6d 43 6f 75 6e 74 | 29 3b 0d 09 69 66 20 28 |temCount|);..if (|
|00001830| 65 72 72 20 21 3d 20 6e | 6f 45 72 72 29 20 67 6f |err != n|oErr) go|
|00001840| 74 6f 20 64 6f 6e 65 3b | 0d 09 69 66 20 28 69 74 |to done;|..if (it|
|00001850| 65 6d 43 6f 75 6e 74 20 | 3d 3d 20 30 29 20 7b 0d |emCount |== 0) {.|
|00001860| 09 09 65 72 72 20 3d 20 | 65 72 72 41 45 45 76 65 |..err = |errAEEve|
|00001870| 6e 74 46 61 69 6c 65 64 | 3b 09 2f 2a 20 43 61 6e |ntFailed|;./* Can|
|00001880| 27 74 20 63 6f 6e 74 69 | 6e 75 65 20 69 66 20 74 |'t conti|nue if t|
|00001890| 68 65 20 6c 69 73 74 20 | 69 73 20 65 6d 70 74 79 |he list |is empty|
|000018a0| 20 2a 2f 0d 09 09 67 6f | 74 6f 20 64 6f 6e 65 3b | */...go|to done;|
|000018b0| 0d 09 7d 0d 09 0d 09 2f | 2a 20 32 2e 20 41 64 64 |..}..../|* 2. Add|
|000018c0| 20 61 20 72 65 73 6f 75 | 72 63 65 20 66 6f 72 20 | a resou|rce for |
|000018d0| 65 61 63 68 20 6f 66 20 | 74 68 65 20 6c 69 73 74 |each of |the list|
|000018e0| 20 69 74 65 6d 73 2c 20 | 72 65 70 6c 61 63 69 6e | items, |replacin|
|000018f0| 67 20 61 6e 79 20 72 65 | 73 6f 75 72 63 65 73 20 |g any re|sources |
|00001900| 77 68 69 63 68 20 6d 61 | 79 20 2a 2f 0d 09 2f 2a |which ma|y */../*|
|00001910| 20 20 20 20 61 6c 72 65 | 61 64 79 20 65 78 69 73 | alre|ady exis|
|00001920| 74 20 74 68 65 72 65 2e | 20 2a 2f 0d 09 66 6f 72 |t there.| */..for|
|00001930| 20 28 6c 69 73 74 49 6e | 64 65 78 20 3d 20 31 3b | (listIn|dex = 1;|
|00001940| 20 6c 69 73 74 49 6e 64 | 65 78 20 3c 3d 20 69 74 | listInd|ex <= it|
|00001950| 65 6d 43 6f 75 6e 74 3b | 20 6c 69 73 74 49 6e 64 |emCount;| listInd|
|00001960| 65 78 2b 2b 29 20 7b 0d | 09 09 65 72 72 20 3d 20 |ex++) {.|..err = |
|00001970| 41 45 47 65 74 4e 74 68 | 44 65 73 63 28 26 65 6e |AEGetNth|Desc(&en|
|00001980| 74 72 79 4c 69 73 74 2c | 20 6c 69 73 74 49 6e 64 |tryList,| listInd|
|00001990| 65 78 2c 20 74 79 70 65 | 57 69 6c 64 43 61 72 64 |ex, type|WildCard|
|000019a0| 2c 20 26 69 74 65 6d 4b | 65 79 77 6f 72 64 2c 20 |, &itemK|eyword, |
|000019b0| 26 69 74 65 6d 44 65 73 | 63 29 3b 0d 09 09 69 66 |&itemDes|c);...if|
|000019c0| 20 28 65 72 72 20 21 3d | 20 6e 6f 45 72 72 29 20 | (err !=| noErr) |
|000019d0| 67 6f 74 6f 20 64 6f 6e | 65 3b 0d 09 09 2f 2a 20 |goto don|e;.../* |
|000019e0| 72 65 6d 6f 76 65 20 61 | 6e 79 20 63 6f 70 69 65 |remove a|ny copie|
|000019f0| 73 20 6f 66 20 74 68 69 | 73 20 72 65 73 6f 75 72 |s of thi|s resour|
|00001a00| 63 65 20 74 68 61 74 20 | 6d 61 79 20 61 6c 72 65 |ce that |may alre|
|00001a10| 61 64 79 20 65 78 69 73 | 74 20 2a 2f 0d 09 09 64 |ady exis|t */...d|
|00001a20| 6f 20 7b 0d 09 09 09 72 | 65 73 48 61 6e 64 6c 65 |o {....r|esHandle|
|00001a30| 20 3d 20 47 65 74 31 52 | 65 73 6f 75 72 63 65 28 | = Get1R|esource(|
|00001a40| 69 74 65 6d 44 65 73 63 | 2e 64 65 73 63 72 69 70 |itemDesc|.descrip|
|00001a50| 74 6f 72 54 79 70 65 2c | 20 72 65 73 49 44 29 3b |torType,| resID);|
|00001a60| 0d 09 09 09 69 66 20 28 | 72 65 73 48 61 6e 64 6c |....if (|resHandl|
|00001a70| 65 20 21 3d 20 30 4c 29 | 20 7b 0d 09 09 09 09 52 |e != 0L)| {.....R|
|00001a80| 6d 76 65 52 65 73 6f 75 | 72 63 65 28 72 65 73 48 |mveResou|rce(resH|
|00001a90| 61 6e 64 6c 65 29 3b 0d | 09 09 09 09 69 66 20 28 |andle);.|....if (|
|00001aa0| 28 65 72 72 20 3d 20 52 | 65 73 45 72 72 6f 72 28 |(err = R|esError(|
|00001ab0| 29 29 20 21 3d 20 6e 6f | 45 72 72 29 20 67 6f 74 |)) != no|Err) got|
|00001ac0| 6f 20 64 6f 6e 65 3b 0d | 09 09 09 09 44 69 73 70 |o done;.|....Disp|
|00001ad0| 6f 73 48 61 6e 64 6c 65 | 28 72 65 73 48 61 6e 64 |osHandle|(resHand|
|00001ae0| 6c 65 29 3b 0d 09 09 09 | 7d 0d 09 09 7d 20 77 68 |le);....|}...} wh|
|00001af0| 69 6c 65 20 28 72 65 73 | 48 61 6e 64 6c 65 20 21 |ile (res|Handle !|
|00001b00| 3d 20 30 4c 29 3b 0d 09 | 09 0d 09 09 2f 2a 20 43 |= 0L);..|..../* C|
|00001b10| 72 65 61 74 65 20 61 20 | 6e 65 77 20 72 65 73 6f |reate a |new reso|
|00001b20| 75 72 63 65 20 2a 2f 0d | 09 09 41 64 64 52 65 73 |urce */.|..AddRes|
|00001b30| 6f 75 72 63 65 28 69 74 | 65 6d 44 65 73 63 2e 64 |ource(it|emDesc.d|
|00001b40| 61 74 61 48 61 6e 64 6c | 65 2c 20 69 74 65 6d 44 |ataHandl|e, itemD|
|00001b50| 65 73 63 2e 64 65 73 63 | 72 69 70 74 6f 72 54 79 |esc.desc|riptorTy|
|00001b60| 70 65 2c 20 72 65 73 49 | 44 2c 20 22 5c 70 22 29 |pe, resI|D, "\p")|
|00001b70| 3b 0d 09 09 57 72 69 74 | 65 52 65 73 6f 75 72 63 |;...Writ|eResourc|
|00001b80| 65 28 69 74 65 6d 44 65 | 73 63 2e 64 61 74 61 48 |e(itemDe|sc.dataH|
|00001b90| 61 6e 64 6c 65 29 3b 0d | 09 09 69 66 20 28 28 65 |andle);.|..if ((e|
|00001ba0| 72 72 20 3d 20 52 65 73 | 45 72 72 6f 72 28 29 29 |rr = Res|Error())|
|00001bb0| 20 21 3d 20 6e 6f 45 72 | 72 29 20 67 6f 74 6f 20 | != noEr|r) goto |
|00001bc0| 64 6f 6e 65 3b 0d 09 09 | 52 65 6c 65 61 73 65 52 |done;...|ReleaseR|
|00001bd0| 65 73 6f 75 72 63 65 28 | 69 74 65 6d 44 65 73 63 |esource(|itemDesc|
|00001be0| 2e 64 61 74 61 48 61 6e | 64 6c 65 29 3b 09 09 2f |.dataHan|dle);../|
|00001bf0| 2a 20 57 65 20 64 6f 6e | 27 74 20 6e 65 65 64 20 |* We don|'t need |
|00001c00| 74 6f 20 6b 65 65 70 20 | 74 68 69 73 20 72 65 73 |to keep |this res|
|00001c10| 6f 75 72 63 65 20 2a 2f | 0d 09 09 09 09 09 09 09 |ource */|........|
|00001c20| 09 09 09 09 09 09 2f 2a | 20 69 6e 20 6d 65 6d 6f |....../*| in memo|
|00001c30| 72 79 2e 20 2a 2f 0d 09 | 09 2f 2a 20 57 65 20 64 |ry. */..|./* We d|
|00001c40| 6f 6e 27 74 20 6e 65 65 | 64 20 74 6f 20 64 69 73 |on't nee|d to dis|
|00001c50| 70 6f 73 65 20 6f 66 20 | 74 68 65 20 41 45 44 65 |pose of |the AEDe|
|00001c60| 73 63 20 73 69 6e 63 65 | 20 74 68 65 20 68 61 6e |sc since| the han|
|00001c70| 64 6c 65 20 68 61 73 20 | 62 65 65 6e 20 63 6f 6e |dle has |been con|
|00001c80| 76 65 72 74 65 64 20 2a | 2f 0d 09 09 2f 2a 20 69 |verted *|/.../* i|
|00001c90| 6e 74 6f 20 61 20 72 65 | 73 6f 75 72 63 65 2c 20 |nto a re|source, |
|00001ca0| 61 6e 64 20 52 65 6c 65 | 61 73 65 52 65 73 6f 75 |and Rele|aseResou|
|00001cb0| 72 63 65 20 64 69 73 70 | 6f 73 65 64 20 6f 66 20 |rce disp|osed of |
|00001cc0| 69 74 20 66 6f 72 20 75 | 73 2e 20 2a 2f 0d 09 7d |it for u|s. */..}|
|00001cd0| 0d 09 0d 64 6f 6e 65 3a | 0d 09 69 66 20 28 65 6e |...done:|..if (en|
|00001ce0| 74 72 79 4c 69 73 74 2e | 64 61 74 61 48 61 6e 64 |tryList.|dataHand|
|00001cf0| 6c 65 20 21 3d 20 4e 55 | 4c 4c 29 0d 09 09 28 76 |le != NU|LL)...(v|
|00001d00| 6f 69 64 29 20 41 45 44 | 69 73 70 6f 73 65 44 65 |oid) AED|isposeDe|
|00001d10| 73 63 28 26 65 6e 74 72 | 79 4c 69 73 74 29 3b 0d |sc(&entr|yList);.|
|00001d20| 09 72 65 74 75 72 6e 20 | 65 72 72 3b 0d 7d 09 2f |.return |err;.}./|
|00001d30| 2a 20 50 75 74 31 53 63 | 72 61 70 62 6f 6f 6b 49 |* Put1Sc|rapbookI|
|00001d40| 74 65 6d 20 2a 2f 0d 0d | 0d 4f 53 45 72 72 20 49 |tem */..|.OSErr I|
|00001d50| 6e 73 65 72 74 53 63 72 | 61 70 62 6f 6f 6b 45 6e |nsertScr|apbookEn|
|00001d60| 74 72 79 20 28 73 68 6f | 72 74 20 65 6e 74 72 79 |try (sho|rt entry|
|00001d70| 4e 75 6d 2c 20 63 6f 6e | 73 74 20 41 45 44 65 73 |Num, con|st AEDes|
|00001d80| 63 4c 69 73 74 20 2a 69 | 74 65 6d 4c 69 73 74 29 |cList *i|temList)|
|00001d90| 0d 7b 0d 09 2f 2a 20 54 | 68 69 73 20 61 64 64 73 |.{../* T|his adds|
|00001da0| 20 61 20 6e 65 77 20 65 | 6e 74 72 79 20 74 6f 20 | a new e|ntry to |
|00001db0| 74 68 65 20 73 63 72 61 | 70 62 6f 6f 6b 20 66 69 |the scra|pbook fi|
|00001dc0| 6c 65 20 62 65 66 6f 72 | 65 20 74 68 65 20 65 6e |le befor|e the en|
|00001dd0| 74 72 79 20 73 70 65 63 | 69 66 69 65 64 20 62 79 |try spec|ified by|
|00001de0| 20 2a 2f 0d 09 2f 2a 20 | 22 65 6e 74 72 79 4e 75 | */../* |"entryNu|
|00001df0| 6d 22 2e 20 2a 2f 0d 09 | 73 6d 61 70 48 61 6e 64 |m". */..|smapHand|
|00001e00| 09 74 68 65 53 6d 61 70 | 3b 0d 09 63 68 61 72 09 |.theSmap|;..char.|
|00001e10| 09 2a 73 6c 6f 74 50 74 | 72 3b 0d 09 73 68 6f 72 |.*slotPt|r;..shor|
|00001e20| 74 09 09 73 6c 6f 74 4e | 75 6d 2c 20 72 65 73 49 |t..slotN|um, resI|
|00001e30| 44 3b 0d 09 4f 53 45 72 | 72 09 09 65 72 72 3b 0d |D;..OSEr|r..err;.|
|00001e40| 09 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 73 |.unsigne|d char s|
|00001e50| 6c 6f 74 4d 61 70 5b 33 | 33 5d 20 3d 20 7b 30 7d |lotMap[3|3] = {0}|
|00001e60| 3b 20 2f 2a 20 41 64 64 | 20 31 20 65 78 74 72 61 |; /* Add| 1 extra|
|00001e70| 20 62 79 74 65 20 6f 66 | 20 7a 65 72 6f 65 73 20 | byte of| zeroes |
|00001e80| 61 74 20 74 68 65 20 65 | 6e 64 20 61 73 20 61 20 |at the e|nd as a |
|00001e90| 67 75 61 72 64 20 7d 0d | 09 0d 09 2f 2a 20 46 69 |guard }.|.../* Fi|
|00001ea0| 6e 64 20 61 6e 20 65 6d | 70 6c 79 20 73 6c 6f 74 |nd an em|ply slot|
|00001eb0| 20 69 6e 20 74 68 65 20 | 73 6d 61 70 09 2a 2f 0d | in the |smap.*/.|
|00001ec0| 09 74 68 65 53 6d 61 70 | 20 3d 20 28 73 6d 61 70 |.theSmap| = (smap|
|00001ed0| 48 61 6e 64 29 47 65 74 | 31 52 65 73 6f 75 72 63 |Hand)Get|1Resourc|
|00001ee0| 65 28 27 53 4d 41 50 27 | 2c 20 30 29 3b 0d 09 69 |e('SMAP'|, 0);..i|
|00001ef0| 66 20 28 74 68 65 53 6d | 61 70 20 3d 3d 20 30 4c |f (theSm|ap == 0L|
|00001f00| 29 20 72 65 74 75 72 6e | 20 72 65 73 4e 6f 74 46 |) return| resNotF|
|00001f10| 6f 75 6e 64 3b 0d 09 69 | 66 20 28 28 65 72 72 20 |ound;..i|f ((err |
|00001f20| 3d 20 52 65 73 45 72 72 | 6f 72 28 29 29 20 21 3d |= ResErr|or()) !=|
|00001f30| 20 6e 6f 45 72 72 29 20 | 72 65 74 75 72 6e 20 65 | noErr) |return e|
|00001f40| 72 72 3b 0d 09 0d 09 2f | 2a 20 4c 6f 6f 6b 20 66 |rr;..../|* Look f|
|00001f50| 6f 72 20 74 68 65 20 66 | 69 72 73 74 20 6e 6f 6e |or the f|irst non|
|00001f60| 2d 7a 65 72 6f 20 73 6c | 6f 74 20 2a 2f 0d 09 66 |-zero sl|ot */..f|
|00001f70| 6f 72 20 28 73 6c 6f 74 | 4e 75 6d 20 3d 20 30 2c |or (slot|Num = 0,|
|00001f80| 20 73 6c 6f 74 50 74 72 | 20 3d 20 28 63 68 61 72 | slotPtr| = (char|
|00001f90| 20 2a 29 2a 74 68 65 53 | 6d 61 70 3b 09 2f 2a 20 | *)*theS|map;./* |
|00001fa0| 49 6e 69 74 69 61 6c 20 | 63 6f 6e 64 69 74 69 6f |Initial |conditio|
|00001fb0| 6e 73 20 2a 2f 0d 09 20 | 20 20 20 20 28 2a 73 6c |ns */.. | (*sl|
|00001fc0| 6f 74 50 74 72 20 21 3d | 20 27 5c 30 27 29 20 26 |otPtr !=| '\0') &|
|00001fd0| 26 20 28 73 6c 6f 74 4e | 75 6d 20 3c 3d 20 32 35 |& (slotN|um <= 25|
|00001fe0| 35 29 3b 20 09 2f 2a 20 | 74 65 73 74 20 2a 2f 0d |5); ./* |test */.|
|00001ff0| 09 20 20 20 20 20 73 6c | 6f 74 4e 75 6d 2b 2b 2c |. sl|otNum++,|
|00002000| 20 73 6c 6f 74 50 74 72 | 2b 2b 29 20 3b 09 09 09 | slotPtr|++) ;...|
|00002010| 09 09 2f 2a 20 72 65 70 | 65 61 74 20 77 68 69 6c |../* rep|eat whil|
|00002020| 65 20 74 65 73 74 20 3d | 3d 20 74 72 75 65 20 2a |e test =|= true *|
|00002030| 2f 0d 0d 09 20 69 66 20 | 28 73 6c 6f 74 4e 75 6d |/... if |(slotNum|
|00002040| 20 3e 20 32 35 35 29 0d | 09 09 72 65 74 75 72 6e | > 255).|..return|
|00002050| 20 65 72 72 41 45 57 72 | 69 74 65 44 65 6e 69 65 | errAEWr|iteDenie|
|00002060| 64 3b 09 2f 2a 20 57 65 | 27 72 65 20 6f 75 74 20 |d;./* We|'re out |
|00002070| 6f 66 20 73 6c 6f 74 73 | 20 2a 2f 0d 09 0d 09 0d |of slots| */.....|
|00002080| 09 72 65 73 49 44 20 3d | 20 73 6c 6f 74 4e 75 6d |.resID =| slotNum|
|00002090| 20 2d 20 33 32 37 36 38 | 4c 3b 09 09 2f 2a 20 43 | - 32768|L;../* C|
|000020a0| 61 6c 63 75 6c 61 74 65 | 20 61 20 72 65 73 6f 75 |alculate| a resou|
|000020b0| 72 63 65 20 49 44 20 2a | 2f 0d 09 0d 09 2f 2a 20 |rce ID *|/..../* |
|000020c0| 41 64 6a 75 73 74 20 61 | 6c 6c 20 6f 66 20 74 68 |Adjust a|ll of th|
|000020d0| 65 20 73 75 62 73 65 71 | 75 65 6e 74 20 65 6e 74 |e subseq|uent ent|
|000020e0| 72 79 20 6e 75 6d 62 65 | 72 73 20 75 70 77 61 72 |ry numbe|rs upwar|
|000020f0| 64 73 20 61 6e 64 20 63 | 6c 61 69 6d 20 6f 75 72 |ds and c|laim our|
|00002100| 20 73 6c 6f 74 20 2a 2f | 0d 09 65 72 72 20 3d 20 | slot */|..err = |
|00002110| 41 64 6a 75 73 74 53 63 | 72 61 70 62 6f 6f 6b 45 |AdjustSc|rapbookE|
|00002120| 6e 74 72 69 65 73 28 65 | 6e 74 72 79 4e 75 6d 2c |ntries(e|ntryNum,|
|00002130| 20 74 72 75 65 29 3b 0d | 09 69 66 20 28 65 72 72 | true);.|.if (err|
|00002140| 20 21 3d 20 6e 6f 45 72 | 72 29 20 72 65 74 75 72 | != noEr|r) retur|
|00002150| 6e 20 65 72 72 3b 0d 09 | 2a 2a 74 68 65 53 6d 61 |n err;..|**theSma|
|00002160| 70 5b 73 6c 6f 74 4e 75 | 6d 5d 20 3d 20 65 6e 74 |p[slotNu|m] = ent|
|00002170| 72 79 4e 75 6d 3b 0d 09 | 0d 09 2f 2a 20 53 74 6f |ryNum;..|../* Sto|
|00002180| 72 65 20 74 68 65 20 69 | 6e 66 6f 72 6d 61 74 69 |re the i|nformati|
|00002190| 6f 6e 20 77 65 27 76 65 | 20 62 65 65 6e 20 70 61 |on we've| been pa|
|000021a0| 73 73 65 64 20 2a 2f 0d | 09 69 66 20 28 69 74 65 |ssed */.|.if (ite|
|000021b0| 6d 4c 69 73 74 2d 3e 64 | 61 74 61 48 61 6e 64 6c |mList->d|ataHandl|
|000021c0| 65 20 21 3d 20 30 4c 29 | 0d 09 09 65 72 72 20 3d |e != 0L)|...err =|
|000021d0| 20 50 75 74 31 53 63 72 | 61 70 62 6f 6f 6b 49 74 | Put1Scr|apbookIt|
|000021e0| 65 6d 28 65 6e 74 72 79 | 4e 75 6d 2c 20 69 74 65 |em(entry|Num, ite|
|000021f0| 6d 4c 69 73 74 29 3b 0d | 09 09 0d 09 72 65 74 75 |mList);.|....retu|
|00002200| 72 6e 20 65 72 72 3b 0d | 7d 09 2f 2a 20 49 6e 73 |rn err;.|}./* Ins|
|00002210| 65 72 74 53 63 72 61 70 | 62 6f 6f 6b 45 6e 74 72 |ertScrap|bookEntr|
|00002220| 79 20 2a 2f 0d 0d 0d 4f | 53 45 72 72 20 5f 44 65 |y */...O|SErr _De|
|00002230| 6c 65 74 65 31 53 63 72 | 61 70 49 74 65 6d 28 73 |lete1Scr|apItem(s|
|00002240| 68 6f 72 74 20 72 65 73 | 49 44 2c 20 4f 53 54 79 |hort res|ID, OSTy|
|00002250| 70 65 20 69 74 65 6d 54 | 79 70 65 29 0d 2f 2a 20 |pe itemT|ype)./* |
|00002260| 52 65 6d 6f 76 65 20 61 | 20 72 65 73 6f 75 72 63 |Remove a| resourc|
|00002270| 65 20 77 69 74 68 20 61 | 20 70 61 72 74 69 63 75 |e with a| particu|
|00002280| 6c 61 72 20 74 79 70 65 | 20 61 6e 64 20 49 44 20 |lar type| and ID |
|00002290| 66 72 6f 6d 20 74 68 65 | 20 73 63 72 61 70 62 6f |from the| scrapbo|
|000022a0| 6f 6b 20 66 69 6c 65 20 | 2a 2f 0d 7b 0d 09 4f 53 |ok file |*/.{..OS|
|000022b0| 45 72 72 09 65 72 72 20 | 3d 20 6e 6f 45 72 72 3b |Err.err |= noErr;|
|000022c0| 0d 09 48 61 6e 64 6c 65 | 09 72 65 73 48 61 6e 64 |..Handle|.resHand|
|000022d0| 6c 65 3b 0d 09 0d 09 77 | 68 69 6c 65 20 28 74 72 |le;....w|hile (tr|
|000022e0| 75 65 29 20 7b 0d 09 09 | 2f 2a 20 52 65 6d 6f 76 |ue) {...|/* Remov|
|000022f0| 65 20 65 61 63 68 20 69 | 6e 73 74 61 6e 63 65 20 |e each i|nstance |
|00002300| 6f 66 20 74 68 69 73 20 | 72 65 73 6f 75 72 63 65 |of this |resource|
|00002310| 20 2a 2f 0d 09 09 72 65 | 73 48 61 6e 64 6c 65 20 | */...re|sHandle |
|00002320| 3d 20 47 65 74 31 52 65 | 73 6f 75 72 63 65 28 69 |= Get1Re|source(i|
|00002330| 74 65 6d 54 79 70 65 2c | 20 72 65 73 49 44 29 3b |temType,| resID);|
|00002340| 0d 09 09 69 66 20 28 72 | 65 73 48 61 6e 64 6c 65 |...if (r|esHandle|
|00002350| 20 3d 3d 20 30 4c 29 20 | 62 72 65 61 6b 3b 0d 09 | == 0L) |break;..|
|00002360| 09 69 66 20 28 28 65 72 | 72 20 3d 20 52 65 73 45 |.if ((er|r = ResE|
|00002370| 72 72 6f 72 28 29 29 20 | 21 3d 20 6e 6f 45 72 72 |rror()) |!= noErr|
|00002380| 29 20 62 72 65 61 6b 3b | 0d 09 09 52 6d 76 65 52 |) break;|...RmveR|
|00002390| 65 73 6f 75 72 63 65 28 | 72 65 73 48 61 6e 64 6c |esource(|resHandl|
|000023a0| 65 29 3b 0d 09 09 44 69 | 73 70 6f 73 48 61 6e 64 |e);...Di|sposHand|
|000023b0| 6c 65 28 72 65 73 48 61 | 6e 64 6c 65 29 3b 0d 09 |le(resHa|ndle);..|
|000023c0| 09 69 66 20 28 28 65 72 | 72 20 3d 20 52 65 73 45 |.if ((er|r = ResE|
|000023d0| 72 72 6f 72 28 29 29 20 | 21 3d 20 6e 6f 45 72 72 |rror()) |!= noErr|
|000023e0| 29 20 62 72 65 61 6b 3b | 0d 09 7d 3b 0d 09 72 65 |) break;|..};..re|
|000023f0| 74 75 72 6e 20 65 72 72 | 3b 0d 7d 20 2f 2a 20 5f |turn err|;.} /* _|
|00002400| 44 65 6c 65 74 65 31 53 | 63 72 61 70 49 74 65 6d |Delete1S|crapItem|
|00002410| 20 2a 2f 0d 0d 0d 0d 4f | 53 45 72 72 20 41 64 6a | */....O|SErr Adj|
|00002420| 75 73 74 53 63 72 61 70 | 62 6f 6f 6b 45 6e 74 72 |ustScrap|bookEntr|
|00002430| 69 65 73 28 73 68 6f 72 | 74 20 73 74 61 72 74 56 |ies(shor|t startV|
|00002440| 61 6c 75 65 2c 20 42 6f | 6f 6c 65 61 6e 20 61 64 |alue, Bo|olean ad|
|00002450| 6a 75 73 74 55 70 77 61 | 72 64 73 29 0d 7b 0d 09 |justUpwa|rds).{..|
|00002460| 2f 2a 20 54 68 69 73 20 | 69 73 20 75 73 65 64 20 |/* This |is used |
|00002470| 74 6f 20 61 64 6a 75 73 | 74 20 65 6e 74 72 79 20 |to adjus|t entry |
|00002480| 6e 75 6d 62 65 72 73 20 | 69 6e 20 74 68 65 20 73 |numbers |in the s|
|00002490| 63 72 61 70 62 6f 6f 6b | 20 77 68 65 6e 20 61 6e |crapbook| when an|
|000024a0| 20 65 6e 74 72 79 20 69 | 73 20 20 2a 2f 0d 09 2f | entry i|s */../|
|000024b0| 2a 20 69 6e 73 65 72 74 | 65 64 20 6f 72 20 64 65 |* insert|ed or de|
|000024c0| 6c 65 74 65 64 2e 20 49 | 66 20 79 6f 75 20 77 61 |leted. I|f you wa|
|000024d0| 6e 74 20 74 6f 20 69 6e | 73 65 72 74 20 61 6e 20 |nt to in|sert an |
|000024e0| 69 74 65 6d 20 69 6e 20 | 66 72 6f 6e 74 20 6f 66 |item in |front of|
|000024f0| 20 65 6e 74 72 79 20 6e | 2c 20 2a 2f 0d 09 2f 2a | entry n|, */../*|
|00002500| 20 74 68 65 6e 20 79 6f | 75 20 63 61 6c 6c 20 74 | then yo|u call t|
|00002510| 68 69 73 20 77 69 74 68 | 20 28 6e 2c 20 74 72 75 |his with| (n, tru|
|00002520| 65 29 20 61 6e 64 20 65 | 6e 74 72 79 20 6e 20 62 |e) and e|ntry n b|
|00002530| 65 63 6f 6d 65 73 20 6e | 2b 31 2c 20 6e 2b 31 20 |ecomes n|+1, n+1 |
|00002540| 62 65 63 6f 6d 65 73 20 | 20 2a 2f 0d 09 2f 2a 20 |becomes | */../* |
|00002550| 6e 2b 32 2c 20 65 74 63 | 2e 20 49 66 20 79 6f 75 |n+2, etc|. If you|
|00002560| 20 77 61 6e 74 20 74 6f | 20 64 65 6c 65 74 65 20 | want to| delete |
|00002570| 65 6e 74 72 79 20 6e 2c | 20 79 6f 75 20 64 65 6c |entry n,| you del|
|00002580| 65 74 65 20 61 6e 64 20 | 7a 65 72 6f 20 74 68 65 |ete and |zero the|
|00002590| 20 53 4d 41 50 20 20 20 | 2a 2f 0d 09 2f 2a 20 65 | SMAP |*/../* e|
|000025a0| 6e 74 72 79 2c 20 61 6e | 64 20 74 68 65 6e 20 63 |ntry, an|d then c|
|000025b0| 61 6c 6c 20 74 68 69 73 | 20 77 69 74 68 20 65 69 |all this| with ei|
|000025c0| 74 68 65 72 20 6e 20 6f | 72 20 6e 2b 31 20 61 6e |ther n o|r n+1 an|
|000025d0| 64 20 22 66 61 6c 73 65 | 22 2e 20 45 6e 74 72 79 |d "false|". Entry|
|000025e0| 20 6e 2b 31 20 20 20 2a | 2f 0d 09 2f 2a 20 77 69 | n+1 *|/../* wi|
|000025f0| 6c 6c 20 62 65 63 6f 6d | 65 20 65 6e 74 72 79 20 |ll becom|e entry |
|00002600| 6e 2c 20 65 6e 74 72 79 | 20 6e 2b 32 20 77 69 6c |n, entry| n+2 wil|
|00002610| 6c 20 62 65 63 6f 6d 65 | 20 6e 2b 31 2c 20 65 74 |l become| n+1, et|
|00002620| 63 2e 09 09 09 09 09 20 | 20 20 2a 2f 0d 09 0d 09 |c...... | */....|
|00002630| 73 6d 61 70 48 61 6e 64 | 09 74 68 65 53 6d 61 70 |smapHand|.theSmap|
|00002640| 48 61 6e 64 3b 0d 09 4f | 53 45 72 72 09 09 65 72 |Hand;..O|SErr..er|
|00002650| 72 3b 0d 09 73 68 6f 72 | 74 09 09 63 6f 75 6e 74 |r;..shor|t..count|
|00002660| 3b 0d 09 63 68 61 72 09 | 09 2a 65 6e 74 72 79 50 |;..char.|.*entryP|
|00002670| 74 72 3b 0d 09 0d 09 69 | 66 20 28 28 73 74 61 72 |tr;....i|f ((star|
|00002680| 74 56 61 6c 75 65 20 3c | 3d 20 30 29 20 7c 7c 20 |tValue <|= 0) || |
|00002690| 28 73 74 61 72 74 56 61 | 6c 75 65 20 3e 3d 20 32 |(startVa|lue >= 2|
|000026a0| 35 36 29 29 0d 09 09 72 | 65 74 75 72 6e 20 65 72 |56))...r|eturn er|
|000026b0| 72 41 45 4e 6f 53 75 63 | 68 4f 62 6a 65 63 74 3b |rAENoSuc|hObject;|
|000026c0| 0d 09 74 68 65 53 6d 61 | 70 48 61 6e 64 20 3d 20 |..theSma|pHand = |
|000026d0| 28 73 6d 61 70 48 61 6e | 64 29 47 65 74 31 52 65 |(smapHan|d)Get1Re|
|000026e0| 73 6f 75 72 63 65 28 27 | 53 4d 41 50 27 2c 20 30 |source('|SMAP', 0|
|000026f0| 29 3b 09 2f 2a 20 54 68 | 65 20 53 4d 41 50 20 69 |);./* Th|e SMAP i|
|00002700| 73 20 74 68 65 20 69 6e | 64 65 78 20 74 6f 20 74 |s the in|dex to t|
|00002710| 68 65 20 72 65 73 6f 75 | 72 63 65 73 20 09 2a 2f |he resou|rces .*/|
|00002720| 0d 09 69 66 20 28 74 68 | 65 53 6d 61 70 48 61 6e |..if (th|eSmapHan|
|00002730| 64 20 3d 3d 20 30 4c 29 | 20 72 65 74 75 72 6e 20 |d == 0L)| return |
|00002740| 72 65 73 4e 6f 74 46 6f | 75 6e 64 3b 09 09 09 2f |resNotFo|und;.../|
|00002750| 2a 20 63 6f 6e 74 61 69 | 6e 65 64 20 77 69 74 68 |* contai|ned with|
|00002760| 69 6e 20 74 68 65 20 73 | 63 72 61 70 62 6f 6f 6b |in the s|crapbook|
|00002770| 20 66 69 6c 65 2e 20 09 | 2a 2f 0d 09 69 66 20 28 | file. .|*/..if (|
|00002780| 28 65 72 72 20 3d 20 52 | 65 73 45 72 72 6f 72 28 |(err = R|esError(|
|00002790| 29 29 20 21 3d 20 6e 6f | 45 72 72 29 20 72 65 74 |)) != no|Err) ret|
|000027a0| 75 72 6e 20 65 72 72 3b | 0d 0d 09 66 6f 72 20 28 |urn err;|...for (|
|000027b0| 63 6f 75 6e 74 20 3d 20 | 30 2c 20 65 6e 74 72 79 |count = |0, entry|
|000027c0| 50 74 72 20 3d 20 28 63 | 68 61 72 20 2a 29 2a 74 |Ptr = (c|har *)*t|
|000027d0| 68 65 53 6d 61 70 48 61 | 6e 64 3b 20 63 6f 75 6e |heSmapHa|nd; coun|
|000027e0| 74 20 3c 3d 20 32 35 35 | 3b 20 63 6f 75 6e 74 2b |t <= 255|; count+|
|000027f0| 2b 2c 20 65 6e 74 72 79 | 50 74 72 2b 2b 29 0d 09 |+, entry|Ptr++)..|
|00002800| 09 69 66 20 28 2a 65 6e | 74 72 79 50 74 72 20 3e |.if (*en|tryPtr >|
|00002810| 3d 20 73 74 61 72 74 56 | 61 6c 75 65 29 20 7b 0d |= startV|alue) {.|
|00002820| 09 09 09 69 66 20 28 61 | 64 6a 75 73 74 55 70 77 |...if (a|djustUpw|
|00002830| 61 72 64 73 29 0d 09 09 | 09 09 28 2a 65 6e 74 72 |ards)...|..(*entr|
|00002840| 79 50 74 72 29 20 2b 3d | 20 31 3b 0d 09 09 09 65 |yPtr) +=| 1;....e|
|00002850| 6c 73 65 0d 09 09 09 09 | 28 2a 65 6e 74 72 79 50 |lse.....|(*entryP|
|00002860| 74 72 29 20 2d 3d 20 31 | 3b 0d 09 09 7d 0d 09 43 |tr) -= 1|;...}..C|
|00002870| 68 61 6e 67 65 64 52 65 | 73 6f 75 72 63 65 28 28 |hangedRe|source((|
|00002880| 48 61 6e 64 6c 65 29 74 | 68 65 53 6d 61 70 48 61 |Handle)t|heSmapHa|
|00002890| 6e 64 29 3b 0d 09 69 66 | 20 28 28 65 72 72 20 3d |nd);..if| ((err =|
|000028a0| 20 52 65 73 45 72 72 6f | 72 28 29 29 20 21 3d 20 | ResErro|r()) != |
|000028b0| 6e 6f 45 72 72 29 20 72 | 65 74 75 72 6e 20 65 72 |noErr) r|eturn er|
|000028c0| 72 3b 0d 09 57 72 69 74 | 65 52 65 73 6f 75 72 63 |r;..Writ|eResourc|
|000028d0| 65 28 28 48 61 6e 64 6c | 65 29 74 68 65 53 6d 61 |e((Handl|e)theSma|
|000028e0| 70 48 61 6e 64 29 3b 0d | 09 65 72 72 20 3d 20 52 |pHand);.|.err = R|
|000028f0| 65 73 45 72 72 6f 72 28 | 29 3b 0d 09 0d 09 72 65 |esError(|);....re|
|00002900| 74 75 72 6e 20 65 72 72 | 3b 0d 7d 0d 0d 0d 4f 53 |turn err|;.}...OS|
|00002910| 45 72 72 20 5a 65 72 6f | 53 63 72 61 70 62 6f 6f |Err Zero|Scrapboo|
|00002920| 6b 49 6e 64 65 78 28 73 | 68 6f 72 74 20 73 6d 61 |kIndex(s|hort sma|
|00002930| 70 49 6e 64 65 78 29 0d | 7b 0d 09 2f 2a 20 54 68 |pIndex).|{../* Th|
|00002940| 69 73 20 69 73 20 63 61 | 6c 6c 65 64 20 77 68 65 |is is ca|lled whe|
|00002950| 6e 20 61 6c 6c 20 6f 66 | 20 74 68 65 20 65 6c 65 |n all of| the ele|
|00002960| 6d 65 6e 74 73 20 6f 66 | 20 74 68 20 69 74 65 6d |ments of| th item|
|00002970| 20 61 74 20 22 73 6d 61 | 70 49 6e 64 65 78 22 20 | at "sma|pIndex" |
|00002980| 68 61 76 65 20 62 65 65 | 6e 09 2a 2f 0d 09 2f 2a |have bee|n.*/../*|
|00002990| 20 64 65 6c 65 74 65 64 | 2e 20 49 74 20 72 65 6d | deleted|. It rem|
|000029a0| 6f 76 65 73 20 74 68 61 | 74 20 69 74 65 6d 27 73 |oves tha|t item's|
|000029b0| 20 65 6e 74 72 79 20 66 | 72 6f 6d 20 74 68 65 20 | entry f|rom the |
|000029c0| 73 63 72 61 70 62 6f 6f | 6b 20 6d 61 70 2e 09 09 |scrapboo|k map...|
|000029d0| 09 09 2a 2f 0d 09 73 6d | 61 70 48 61 6e 64 09 74 |..*/..sm|apHand.t|
|000029e0| 68 65 53 6d 61 70 3b 0d | 09 4f 53 45 72 72 09 09 |heSmap;.|.OSErr..|
|000029f0| 65 72 72 3b 0d 09 0d 09 | 74 68 65 53 6d 61 70 20 |err;....|theSmap |
|00002a00| 3d 20 28 73 6d 61 70 48 | 61 6e 64 29 47 65 74 31 |= (smapH|and)Get1|
|00002a10| 52 65 73 6f 75 72 63 65 | 28 27 53 4d 41 50 27 2c |Resource|('SMAP',|
|00002a20| 20 30 29 3b 09 2f 2a 20 | 54 68 65 20 53 4d 41 50 | 0);./* |The SMAP|
|00002a30| 20 69 73 20 74 68 65 20 | 69 6e 64 65 78 20 74 6f | is the |index to|
|00002a40| 20 74 68 65 20 72 65 73 | 6f 75 72 63 65 73 20 09 | the res|ources .|
|00002a50| 2a 2f 0d 09 69 66 20 28 | 74 68 65 53 6d 61 70 20 |*/..if (|theSmap |
|00002a60| 3d 3d 20 30 4c 29 20 72 | 65 74 75 72 6e 20 72 65 |== 0L) r|eturn re|
|00002a70| 73 4e 6f 74 46 6f 75 6e | 64 3b 09 09 09 2f 2a 20 |sNotFoun|d;.../* |
|00002a80| 63 6f 6e 74 61 69 6e 65 | 64 20 77 69 74 68 69 6e |containe|d within|
|00002a90| 20 74 68 65 20 73 63 72 | 61 70 62 6f 6f 6b 20 66 | the scr|apbook f|
|00002aa0| 69 6c 65 2e 20 09 2a 2f | 0d 09 69 66 20 28 28 65 |ile. .*/|..if ((e|
|00002ab0| 72 72 20 3d 20 52 65 73 | 45 72 72 6f 72 28 29 29 |rr = Res|Error())|
|00002ac0| 20 21 3d 20 6e 6f 45 72 | 72 29 20 72 65 74 75 72 | != noEr|r) retur|
|00002ad0| 6e 20 65 72 72 3b 0d 0d | 09 28 2a 2a 74 68 65 53 |n err;..|.(**theS|
|00002ae0| 6d 61 70 29 5b 73 6d 61 | 70 49 6e 64 65 78 5d 20 |map)[sma|pIndex] |
|00002af0| 3d 20 30 3b 0d 09 0d 09 | 43 68 61 6e 67 65 64 52 |= 0;....|ChangedR|
|00002b00| 65 73 6f 75 72 63 65 28 | 28 48 61 6e 64 6c 65 29 |esource(|(Handle)|
|00002b10| 74 68 65 53 6d 61 70 29 | 3b 0d 09 65 72 72 20 3d |theSmap)|;..err =|
|00002b20| 20 52 65 73 45 72 72 6f | 72 28 29 3b 0d 09 0d 09 | ResErro|r();....|
|00002b30| 72 65 74 75 72 6e 20 65 | 72 72 3b 0d 7d 0d 0d 0d |return e|rr;.}...|
|00002b40| 4f 53 45 72 72 20 44 65 | 6c 65 74 65 31 53 63 72 |OSErr De|lete1Scr|
|00002b50| 61 70 62 6f 6f 6b 49 74 | 65 6d 20 28 73 68 6f 72 |apbookIt|em (shor|
|00002b60| 74 20 65 6e 74 72 79 49 | 6e 64 65 78 2c 20 4f 53 |t entryI|ndex, OS|
|00002b70| 54 79 70 65 20 69 74 65 | 6d 54 79 70 65 2c 20 42 |Type ite|mType, B|
|00002b80| 6f 6f 6c 65 61 6e 20 2a | 65 6e 74 72 79 52 65 6d |oolean *|entryRem|
|00002b90| 6f 76 65 64 29 0d 7b 0d | 09 2f 2a 20 44 65 6c 65 |oved).{.|./* Dele|
|00002ba0| 74 65 20 74 68 65 20 69 | 74 65 6d 20 6f 66 20 74 |te the i|tem of t|
|00002bb0| 68 65 20 67 69 76 65 6e | 20 74 79 70 65 20 66 72 |he given| type fr|
|00002bc0| 6f 6d 20 74 68 65 20 67 | 69 76 65 6e 20 73 63 72 |om the g|iven scr|
|00002bd0| 61 70 62 6f 6f 6b 20 65 | 6e 74 72 79 20 09 2a 2f |apbook e|ntry .*/|
|00002be0| 0d 09 2f 2a 20 49 66 20 | 69 74 65 6d 54 79 70 65 |../* If |itemType|
|00002bf0| 20 3d 3d 20 74 79 70 65 | 57 69 6c 64 43 61 72 64 | == type|WildCard|
|00002c00| 2c 20 74 68 65 6e 20 61 | 6c 6c 20 65 6e 74 72 69 |, then a|ll entri|
|00002c10| 65 73 20 61 72 65 20 64 | 65 6c 65 74 65 64 20 66 |es are d|eleted f|
|00002c20| 6f 72 20 74 68 61 74 20 | 09 2a 2f 0d 09 2f 2a 20 |or that |.*/../* |
|00002c30| 65 6e 74 72 79 2e 09 09 | 09 09 09 09 09 09 09 09 |entry...|........|
|00002c40| 09 09 09 09 09 09 2a 2f | 0d 09 52 65 73 54 79 70 |......*/|..ResTyp|
|00002c50| 65 09 09 6f 6e 65 54 79 | 70 65 3b 0d 09 73 68 6f |e..oneTy|pe;..sho|
|00002c60| 72 74 09 09 72 65 73 49 | 44 2c 20 73 6d 61 70 49 |rt..resI|D, smapI|
|00002c70| 6e 64 65 78 2c 20 6e 75 | 6d 54 79 70 65 73 2c 20 |ndex, nu|mTypes, |
|00002c80| 74 79 70 65 49 6e 64 65 | 78 3b 0d 09 48 61 6e 64 |typeInde|x;..Hand|
|00002c90| 6c 65 09 09 64 75 6d 6d | 79 48 61 6e 64 6c 65 3b |le..dumm|yHandle;|
|00002ca0| 0d 09 4f 53 45 72 72 09 | 09 65 72 72 3b 0d 0d 09 |..OSErr.|.err;...|
|00002cb0| 09 09 0d 09 6e 75 6d 54 | 79 70 65 73 20 3d 20 43 |....numT|ypes = C|
|00002cc0| 6f 75 6e 74 31 54 79 70 | 65 73 28 29 3b 20 09 2f |ount1Typ|es(); ./|
|00002cd0| 2a 20 57 65 27 6c 6c 20 | 75 73 65 20 74 68 69 73 |* We'll |use this|
|00002ce0| 20 74 6f 20 31 29 20 73 | 63 61 6e 20 61 6c 6c 20 | to 1) s|can all |
|00002cf0| 74 79 70 65 73 20 6f 6e | 20 61 20 22 64 65 6c 65 |types on| a "dele|
|00002d00| 74 65 20 61 6c 6c 22 20 | 2a 2f 0d 09 09 09 09 09 |te all" |*/......|
|00002d10| 09 09 09 2f 2a 20 72 65 | 71 75 65 73 74 20 61 6e |.../* re|quest an|
|00002d20| 64 20 32 29 20 73 63 61 | 6e 20 61 6c 6c 20 74 79 |d 2) sca|n all ty|
|00002d30| 70 65 73 20 74 6f 20 73 | 65 65 20 69 66 20 61 6e |pes to s|ee if an|
|00002d40| 79 20 65 6e 74 72 69 65 | 73 20 20 20 2a 2f 0d 09 |y entrie|s */..|
|00002d50| 09 09 09 09 09 09 09 2f | 2a 20 72 65 6d 61 69 6e |......./|* remain|
|00002d60| 20 6f 6e 20 61 20 22 64 | 65 6c 65 74 65 20 31 20 | on a "d|elete 1 |
|00002d70| 74 79 70 65 22 20 72 65 | 71 75 65 73 74 2e 09 09 |type" re|quest...|
|00002d80| 09 09 09 20 2a 2f 0d 09 | 09 09 09 09 09 09 09 0d |... */..|........|
|00002d90| 09 2a 65 6e 74 72 79 52 | 65 6d 6f 76 65 64 20 3d |.*entryR|emoved =|
|00002da0| 20 66 61 6c 73 65 3b 0d | 09 65 72 72 20 3d 20 5f | false;.|.err = _|
|00002db0| 45 6e 74 72 79 54 6f 53 | 63 72 61 70 49 6e 64 65 |EntryToS|crapInde|
|00002dc0| 78 28 65 6e 74 72 79 49 | 6e 64 65 78 2c 20 26 73 |x(entryI|ndex, &s|
|00002dd0| 6d 61 70 49 6e 64 65 78 | 2c 20 26 72 65 73 49 44 |mapIndex|, &resID|
|00002de0| 29 3b 0d 09 69 66 20 28 | 65 72 72 20 3d 3d 20 6e |);..if (|err == n|
|00002df0| 6f 45 72 72 29 20 7b 0d | 09 09 2f 2a 20 49 66 20 |oErr) {.|../* If |
|00002e00| 77 65 27 76 65 20 62 65 | 65 6e 20 61 73 6b 65 64 |we've be|en asked|
|00002e10| 20 66 6f 72 20 61 20 73 | 70 65 63 69 66 69 63 20 | for a s|pecific |
|00002e20| 74 79 70 65 2c 20 6c 6f | 6f 6b 20 66 6f 72 20 69 |type, lo|ok for i|
|00002e30| 74 20 2a 2f 0d 09 09 69 | 66 20 28 69 74 65 6d 54 |t */...i|f (itemT|
|00002e40| 79 70 65 20 21 3d 20 74 | 79 70 65 57 69 6c 64 43 |ype != t|ypeWildC|
|00002e50| 61 72 64 29 20 7b 0d 09 | 09 09 65 72 72 20 3d 20 |ard) {..|..err = |
|00002e60| 5f 44 65 6c 65 74 65 31 | 53 63 72 61 70 49 74 65 |_Delete1|ScrapIte|
|00002e70| 6d 28 72 65 73 49 44 2c | 20 69 74 65 6d 54 79 70 |m(resID,| itemTyp|
|00002e80| 65 29 3b 0d 09 09 09 69 | 66 20 28 65 72 72 20 21 |e);....i|f (err !|
|00002e90| 3d 20 6e 6f 45 72 72 29 | 20 72 65 74 75 72 6e 20 |= noErr)| return |
|00002ea0| 65 72 72 3b 0d 09 09 09 | 0d 09 09 09 2f 2a 20 4e |err;....|..../* N|
|00002eb0| 6f 77 2c 20 73 65 65 20 | 69 66 20 6e 6f 20 6d 6f |ow, see |if no mo|
|00002ec0| 72 65 20 72 65 73 6f 75 | 72 63 65 73 20 65 78 69 |re resou|rces exi|
|00002ed0| 73 74 20 66 6f 72 20 74 | 68 69 73 20 73 63 72 61 |st for t|his scra|
|00002ee0| 70 62 6f 6f 6b 20 65 6e | 74 72 79 20 2a 2f 0d 09 |pbook en|try */..|
|00002ef0| 09 09 2f 2a 20 49 66 20 | 73 6f 2c 20 77 65 20 63 |../* If |so, we c|
|00002f00| 61 6e 20 7a 65 72 6f 20 | 74 68 65 20 63 6f 72 72 |an zero |the corr|
|00002f10| 65 73 70 6f 6e 64 69 6e | 67 20 65 6e 74 72 79 20 |espondin|g entry |
|00002f20| 69 6e 20 74 68 65 20 72 | 65 73 6f 75 72 63 65 09 |in the r|esource.|
|00002f30| 2a 2f 0d 09 09 09 2f 2a | 20 6d 61 70 2e 09 09 09 |*/..../*| map....|
|00002f40| 09 09 09 09 09 09 09 09 | 09 09 09 09 2a 2f 0d 09 |........|....*/..|
|00002f50| 09 09 53 65 74 52 65 73 | 4c 6f 61 64 28 66 61 6c |..SetRes|Load(fal|
|00002f60| 73 65 29 3b 09 2f 2a 20 | 57 65 20 6a 75 73 74 20 |se);./* |We just |
|00002f70| 77 61 6e 74 20 74 6f 20 | 6b 6e 6f 77 20 69 66 20 |want to |know if |
|00002f80| 74 68 65 20 72 65 73 6f | 75 72 63 65 73 20 65 78 |the reso|urces ex|
|00002f90| 69 73 74 20 2a 2f 0d 09 | 09 09 66 6f 72 20 28 74 |ist */..|..for (t|
|00002fa0| 79 70 65 49 6e 64 65 78 | 20 3d 20 31 3b 20 74 79 |ypeIndex| = 1; ty|
|00002fb0| 70 65 49 6e 64 65 78 20 | 3c 3d 20 6e 75 6d 54 79 |peIndex |<= numTy|
|00002fc0| 70 65 73 3b 20 74 79 70 | 65 49 6e 64 65 78 2b 2b |pes; typ|eIndex++|
|00002fd0| 29 20 7b 0d 09 09 09 09 | 47 65 74 31 49 6e 64 54 |) {.....|Get1IndT|
|00002fe0| 79 70 65 28 26 6f 6e 65 | 54 79 70 65 2c 20 74 79 |ype(&one|Type, ty|
|00002ff0| 70 65 49 6e 64 65 78 29 | 3b 0d 09 09 09 09 69 66 |peIndex)|;.....if|
|00003000| 20 28 28 65 72 72 20 3d | 20 52 65 73 45 72 72 6f | ((err =| ResErro|
|00003010| 72 28 29 29 20 21 3d 20 | 6e 6f 45 72 72 29 20 62 |r()) != |noErr) b|
|00003020| 72 65 61 6b 3b 0d 09 09 | 09 09 28 76 6f 69 64 29 |reak;...|..(void)|
|00003030| 20 47 65 74 31 52 65 73 | 6f 75 72 63 65 28 6f 6e | Get1Res|ource(on|
|00003040| 65 54 79 70 65 2c 20 72 | 65 73 49 44 29 3b 20 2f |eType, r|esID); /|
|00003050| 2a 20 28 76 6f 69 64 29 | 20 3d 3d 20 69 67 6e 6f |* (void)| == igno|
|00003060| 72 65 20 74 68 65 20 72 | 65 74 75 72 6e 65 64 20 |re the r|eturned |
|00003070| 68 61 6e 64 6c 65 20 2a | 2f 0d 09 09 09 09 69 66 |handle *|/.....if|
|00003080| 20 28 28 65 72 72 20 3d | 20 52 65 73 45 72 72 6f | ((err =| ResErro|
|00003090| 72 28 29 29 20 21 3d 20 | 72 65 73 4e 6f 74 46 6f |r()) != |resNotFo|
|000030a0| 75 6e 64 29 20 62 72 65 | 61 6b 3b 0d 09 09 09 09 |und) bre|ak;.....|
|000030b0| 09 20 2f 2a 20 54 68 61 | 74 27 73 20 6e 6f 74 20 |. /* Tha|t's not |
|000030c0| 61 20 74 79 70 6f 20 2d | 2d 20 45 78 69 74 20 74 |a typo -|- Exit t|
|000030d0| 68 65 20 6c 6f 6f 70 20 | 69 66 20 61 20 2a 2f 0d |he loop |if a */.|
|000030e0| 09 09 09 09 09 20 2f 2a | 20 72 65 73 6f 75 72 63 |..... /*| resourc|
|000030f0| 65 20 77 61 73 20 66 6f | 75 6e 64 20 6f 72 20 73 |e was fo|und or s|
|00003100| 6f 6d 65 20 6f 74 68 65 | 72 20 65 72 72 6f 72 20 |ome othe|r error |
|00003110| 20 2a 2f 0d 09 09 09 09 | 09 20 2f 2a 20 6f 63 63 | */.....|. /* occ|
|00003120| 75 72 72 65 64 2e 09 09 | 09 09 09 09 09 09 2a 2f |urred...|......*/|
|00003130| 0d 09 09 09 7d 0d 09 09 | 09 53 65 74 52 65 73 4c |....}...|.SetResL|
|00003140| 6f 61 64 28 74 72 75 65 | 29 3b 0d 09 09 09 69 66 |oad(true|);....if|
|00003150| 20 28 65 72 72 20 3d 3d | 20 72 65 73 4e 6f 74 46 | (err ==| resNotF|
|00003160| 6f 75 6e 64 29 20 7b 0d | 09 09 09 09 2f 2a 20 4e |ound) {.|..../* N|
|00003170| 6f 20 72 65 73 6f 75 72 | 63 65 73 20 77 65 72 65 |o resour|ces were|
|00003180| 20 66 6f 75 6e 64 2c 20 | 73 6f 20 77 65 20 63 61 | found, |so we ca|
|00003190| 6e 20 72 65 6d 6f 76 65 | 20 74 68 69 73 20 65 6e |n remove| this en|
|000031a0| 74 72 79 20 2a 2f 0d 09 | 09 09 09 65 72 72 20 3d |try */..|...err =|
|000031b0| 20 5a 65 72 6f 53 63 72 | 61 70 62 6f 6f 6b 49 6e | ZeroScr|apbookIn|
|000031c0| 64 65 78 28 73 6d 61 70 | 49 6e 64 65 78 29 3b 0d |dex(smap|Index);.|
|000031d0| 09 09 09 09 69 66 20 28 | 65 72 72 20 21 3d 20 6e |....if (|err != n|
|000031e0| 6f 45 72 72 29 20 72 65 | 74 75 72 6e 20 65 72 72 |oErr) re|turn err|
|000031f0| 3b 0d 09 09 09 09 65 72 | 72 20 3d 20 41 64 6a 75 |;.....er|r = Adju|
|00003200| 73 74 53 63 72 61 70 62 | 6f 6f 6b 45 6e 74 72 69 |stScrapb|ookEntri|
|00003210| 65 73 28 65 6e 74 72 79 | 49 6e 64 65 78 2c 20 66 |es(entry|Index, f|
|00003220| 61 6c 73 65 29 3b 0d 09 | 09 09 09 2a 65 6e 74 72 |alse);..|...*entr|
|00003230| 79 52 65 6d 6f 76 65 64 | 20 3d 20 74 72 75 65 3b |yRemoved| = true;|
|00003240| 0d 09 09 09 7d 0d 09 09 | 7d 0d 09 09 0d 09 09 65 |....}...|}......e|
|00003250| 6c 73 65 20 7b 0d 09 09 | 09 2f 2a 20 54 68 65 20 |lse {...|./* The |
|00003260| 75 73 65 72 20 61 73 6b | 65 64 20 66 6f 72 20 65 |user ask|ed for e|
|00003270| 76 65 72 79 74 68 69 6e | 67 20 69 6e 20 74 68 69 |verythin|g in thi|
|00003280| 73 20 69 74 65 6d 2c 20 | 73 6f 20 77 65 27 6c 6c |s item, |so we'll|
|00003290| 20 6c 6f 6f 6b 20 74 68 | 72 6f 75 67 68 20 61 6c | look th|rough al|
|000032a0| 6c 20 2a 2f 0d 09 09 09 | 2f 2a 20 61 76 61 69 6c |l */....|/* avail|
|000032b0| 61 62 6c 65 20 74 79 70 | 65 73 20 66 6f 72 20 69 |able typ|es for i|
|000032c0| 74 65 6d 73 20 77 69 74 | 68 20 74 68 69 73 20 72 |tems wit|h this r|
|000032d0| 65 73 6f 75 72 63 65 20 | 6e 75 6d 62 65 72 2e 09 |esource |number..|
|000032e0| 09 09 09 09 20 2a 2f 0d | 09 09 09 66 6f 72 20 28 |.... */.|...for (|
|000032f0| 74 79 70 65 49 6e 64 65 | 78 20 3d 20 31 3b 20 74 |typeInde|x = 1; t|
|00003300| 79 70 65 49 6e 64 65 78 | 20 3c 3d 20 6e 75 6d 54 |ypeIndex| <= numT|
|00003310| 79 70 65 73 3b 20 74 79 | 70 65 49 6e 64 65 78 2b |ypes; ty|peIndex+|
|00003320| 2b 29 20 7b 0d 09 09 09 | 09 47 65 74 31 49 6e 64 |+) {....|.Get1Ind|
|00003330| 54 79 70 65 28 26 6f 6e | 65 54 79 70 65 2c 20 74 |Type(&on|eType, t|
|00003340| 79 70 65 49 6e 64 65 78 | 29 3b 0d 09 09 09 09 69 |ypeIndex|);.....i|
|00003350| 66 20 28 28 65 72 72 20 | 3d 20 52 65 73 45 72 72 |f ((err |= ResErr|
|00003360| 6f 72 28 29 29 20 21 3d | 20 6e 6f 45 72 72 29 20 |or()) !=| noErr) |
|00003370| 62 72 65 61 6b 3b 0d 09 | 09 09 09 53 65 74 52 65 |break;..|...SetRe|
|00003380| 73 4c 6f 61 64 28 66 61 | 6c 73 65 29 3b 0d 09 09 |sLoad(fa|lse);...|
|00003390| 09 09 64 75 6d 6d 79 48 | 61 6e 64 6c 65 20 3d 20 |..dummyH|andle = |
|000033a0| 47 65 74 31 52 65 73 6f | 75 72 63 65 28 6f 6e 65 |Get1Reso|urce(one|
|000033b0| 54 79 70 65 2c 20 72 65 | 73 49 44 29 3b 0d 09 09 |Type, re|sID);...|
|000033c0| 09 09 53 65 74 52 65 73 | 4c 6f 61 64 28 74 72 75 |..SetRes|Load(tru|
|000033d0| 65 29 3b 0d 09 09 09 09 | 69 66 20 28 64 75 6d 6d |e);.....|if (dumm|
|000033e0| 79 48 61 6e 64 6c 65 20 | 21 3d 20 4e 55 4c 4c 29 |yHandle |!= NULL)|
|000033f0| 20 7b 0d 09 09 09 09 09 | 65 72 72 20 3d 20 5f 44 | {......|err = _D|
|00003400| 65 6c 65 74 65 31 53 63 | 72 61 70 49 74 65 6d 28 |elete1Sc|rapItem(|
|00003410| 72 65 73 49 44 2c 20 6f | 6e 65 54 79 70 65 29 3b |resID, o|neType);|
|00003420| 0d 09 09 09 09 09 69 66 | 20 28 65 72 72 20 21 3d |......if| (err !=|
|00003430| 20 6e 6f 45 72 72 29 20 | 72 65 74 75 72 6e 20 65 | noErr) |return e|
|00003440| 72 72 3b 0d 09 09 09 09 | 7d 0d 09 09 09 7d 0d 09 |rr;.....|}....}..|
|00003450| 09 09 2f 2a 20 53 69 6e | 63 65 20 77 65 20 64 65 |../* Sin|ce we de|
|00003460| 6c 65 74 65 64 20 61 6c | 6c 20 6f 66 20 74 68 69 |leted al|l of thi|
|00003470| 73 20 69 74 65 6d 73 2c | 20 72 65 6d 6f 76 65 20 |s items,| remove |
|00003480| 74 68 69 73 20 65 6e 74 | 72 79 20 2a 2f 0d 09 09 |this ent|ry */...|
|00003490| 09 69 66 20 28 65 72 72 | 20 3d 3d 20 6e 6f 45 72 |.if (err| == noEr|
|000034a0| 72 29 20 7b 0d 09 09 09 | 09 2a 65 6e 74 72 79 52 |r) {....|.*entryR|
|000034b0| 65 6d 6f 76 65 64 20 3d | 20 74 72 75 65 3b 0d 09 |emoved =| true;..|
|000034c0| 09 09 09 65 72 72 20 3d | 20 5a 65 72 6f 53 63 72 |...err =| ZeroScr|
|000034d0| 61 70 62 6f 6f 6b 49 6e | 64 65 78 28 73 6d 61 70 |apbookIn|dex(smap|
|000034e0| 49 6e 64 65 78 29 3b 0d | 09 09 09 09 69 66 20 28 |Index);.|....if (|
|000034f0| 65 72 72 20 21 3d 20 6e | 6f 45 72 72 29 20 72 65 |err != n|oErr) re|
|00003500| 74 75 72 6e 20 65 72 72 | 3b 0d 09 09 09 09 65 72 |turn err|;.....er|
|00003510| 72 20 3d 20 41 64 6a 75 | 73 74 53 63 72 61 70 62 |r = Adju|stScrapb|
|00003520| 6f 6f 6b 45 6e 74 72 69 | 65 73 28 65 6e 74 72 79 |ookEntri|es(entry|
|00003530| 49 6e 64 65 78 2c 20 66 | 61 6c 73 65 29 3b 0d 09 |Index, f|alse);..|
|00003540| 09 09 7d 0d 09 09 7d 0d | 09 7d 0d 09 72 65 74 75 |..}...}.|.}..retu|
|00003550| 72 6e 20 65 72 72 3b 0d | 7d 20 2f 2a 20 44 65 6c |rn err;.|} /* Del|
|00003560| 65 74 65 31 53 63 72 61 | 70 62 6f 6f 6b 49 74 65 |ete1Scra|pbookIte|
|00003570| 6d 20 2a 2f 0d 0d 0d 2f | 2a 20 53 69 6e 63 65 20 |m */.../|* Since |
|00003580| 74 68 65 20 22 62 65 73 | 74 20 74 79 70 65 22 20 |the "bes|t type" |
|00003590| 66 6f 72 20 61 20 67 69 | 76 65 6e 20 73 63 72 61 |for a gi|ven scra|
|000035a0| 70 62 6f 6f 6b 20 65 6e | 74 72 79 20 76 61 72 69 |pbook en|try vari|
|000035b0| 65 73 20 64 65 70 65 6e | 64 69 6e 67 20 6f 6e 20 |es depen|ding on |
|000035c0| 2a 2f 0d 2f 2a 20 77 68 | 61 74 27 73 20 69 6e 20 |*/./* wh|at's in |
|000035d0| 74 68 61 74 20 65 6e 74 | 72 79 2c 20 77 65 27 76 |that ent|ry, we'v|
|000035e0| 65 20 77 72 69 74 74 65 | 6e 20 74 68 65 20 66 6f |e writte|n the fo|
|000035f0| 6c 6c 6f 77 69 6e 67 20 | 72 6f 75 74 69 6e 65 20 |llowing |routine |
|00003600| 74 6f 20 66 69 6e 64 20 | 74 68 65 20 2a 2f 0d 2f |to find |the */./|
|00003610| 2a 20 62 65 73 74 20 74 | 79 70 65 20 66 6f 72 20 |* best t|ype for |
|00003620| 61 20 67 69 76 65 6e 20 | 65 6e 74 72 79 2e 20 54 |a given |entry. T|
|00003630| 68 65 20 61 6c 67 6f 72 | 69 74 68 6d 20 69 73 20 |he algor|ithm is |
|00003640| 61 73 20 66 6f 6c 6c 6f | 77 73 3a 09 09 09 20 2a |as follo|ws:... *|
|00003650| 2f 0d 2f 2a 20 20 20 31 | 29 20 53 65 61 72 63 68 |/./* 1|) Search|
|00003660| 20 66 6f 72 20 65 6c 65 | 6d 65 6e 74 73 20 6f 66 | for ele|ments of|
|00003670| 20 61 20 70 61 72 74 69 | 63 75 6c 61 72 20 74 79 | a parti|cular ty|
|00003680| 70 65 2c 20 69 6e 20 64 | 65 73 63 65 6e 64 69 6e |pe, in d|escendin|
|00003690| 67 20 6f 72 64 65 72 09 | 20 2a 2f 0d 2f 2a 20 20 |g order.| */./* |
|000036a0| 20 20 20 20 6f 66 20 70 | 72 65 66 65 72 65 6e 63 | of p|referenc|
|000036b0| 65 2e 09 09 09 09 09 09 | 09 09 09 09 09 09 09 20 |e.......|....... |
|000036c0| 2a 2f 0d 2f 2a 20 20 20 | 32 29 20 49 66 20 77 65 |*/./* |2) If we|
|000036d0| 20 66 69 6e 64 20 73 6f | 6d 65 74 68 69 6e 67 2c | find so|mething,|
|000036e0| 20 72 65 74 75 72 6e 20 | 74 68 61 74 20 69 74 65 | return |that ite|
|000036f0| 6d 27 73 20 74 79 70 65 | 20 63 6f 64 65 2e 20 49 |m's type| code. I|
|00003700| 66 20 77 65 09 20 09 20 | 2a 2f 0d 2f 2a 20 09 09 |f we. . |*/./* ..|
|00003710| 64 6f 6e 27 74 2c 20 74 | 68 65 6e 20 72 65 74 75 |don't, t|hen retu|
|00003720| 72 6e 20 74 68 65 20 74 | 79 70 65 20 63 6f 64 65 |rn the t|ype code|
|00003730| 20 66 6f 72 20 74 68 65 | 20 66 69 72 73 74 20 69 | for the| first i|
|00003740| 74 65 6d 2e 09 09 09 20 | 2a 2f 0d 0d 4f 53 45 72 |tem.... |*/..OSEr|
|00003750| 72 20 47 65 74 42 65 73 | 74 54 79 70 65 28 73 68 |r GetBes|tType(sh|
|00003760| 6f 72 74 20 65 6e 74 72 | 79 4e 75 6d 2c 20 52 65 |ort entr|yNum, Re|
|00003770| 73 54 79 70 65 20 2a 62 | 65 73 74 54 79 70 65 29 |sType *b|estType)|
|00003780| 0d 7b 0d 09 4f 53 45 72 | 72 09 09 65 72 72 09 09 |.{..OSEr|r..err..|
|00003790| 09 3d 20 6e 6f 45 72 72 | 3b 0d 09 52 65 73 54 79 |.= noErr|;..ResTy|
|000037a0| 70 65 09 09 70 72 65 66 | 65 72 72 65 64 54 79 70 |pe..pref|erredTyp|
|000037b0| 65 73 5b 33 5d 20 3d 20 | 7b 27 50 49 43 54 27 2c |es[3] = |{'PICT',|
|000037c0| 20 27 54 45 58 54 27 2c | 20 27 73 6e 64 20 27 7d | 'TEXT',| 'snd '}|
|000037d0| 3b 0d 09 73 68 6f 72 74 | 09 09 73 63 72 61 70 49 |;..short|..scrapI|
|000037e0| 6e 64 65 78 2c 20 72 65 | 73 49 44 2c 20 73 63 72 |ndex, re|sID, scr|
|000037f0| 61 74 63 68 3b 0d 09 48 | 61 6e 64 6c 65 09 09 64 |atch;..H|andle..d|
|00003800| 75 6d 6d 79 48 61 6e 64 | 6c 65 3b 0d 09 73 68 6f |ummyHand|le;..sho|
|00003810| 72 74 09 09 63 6f 75 6e | 74 3b 0d 09 0d 09 65 72 |rt..coun|t;....er|
|00003820| 72 20 3d 20 5f 45 6e 74 | 72 79 54 6f 53 63 72 61 |r = _Ent|ryToScra|
|00003830| 70 49 6e 64 65 78 28 65 | 6e 74 72 79 4e 75 6d 2c |pIndex(e|ntryNum,|
|00003840| 20 26 73 63 72 61 70 49 | 6e 64 65 78 2c 20 26 72 | &scrapI|ndex, &r|
|00003850| 65 73 49 44 29 3b 0d 09 | 69 66 20 28 65 72 72 20 |esID);..|if (err |
|00003860| 21 3d 20 6e 6f 45 72 72 | 29 20 72 65 74 75 72 6e |!= noErr|) return|
|00003870| 20 65 72 72 3b 0d 0d 09 | 2f 2a 20 46 69 72 73 74 | err;...|/* First|
|00003880| 2c 20 77 65 27 6c 6c 20 | 74 72 79 20 66 6f 72 20 |, we'll |try for |
|00003890| 6f 6e 65 20 6f 66 20 6f | 75 72 20 70 72 65 66 65 |one of o|ur prefe|
|000038a0| 72 72 65 64 20 74 79 70 | 65 73 20 2a 2f 0d 09 53 |rred typ|es */..S|
|000038b0| 65 74 52 65 73 4c 6f 61 | 64 28 66 61 6c 73 65 29 |etResLoa|d(false)|
|000038c0| 3b 09 2f 2a 20 57 65 20 | 6f 6e 6c 79 20 77 61 6e |;./* We |only wan|
|000038d0| 74 20 74 6f 20 6b 6e 6f | 77 20 69 66 20 70 61 72 |t to kno|w if par|
|000038e0| 74 69 63 75 6c 61 72 20 | 72 65 73 6f 75 72 63 65 |ticular |resource|
|000038f0| 73 20 65 78 69 73 74 2c | 20 2a 2f 0d 09 09 09 09 |s exist,| */.....|
|00003900| 09 09 2f 2a 20 62 75 74 | 20 77 65 20 64 6f 6e 27 |../* but| we don'|
|00003910| 74 20 77 61 6e 74 20 74 | 6f 20 6c 6f 61 64 20 74 |t want t|o load t|
|00003920| 68 65 6d 20 68 65 72 65 | 2e 09 09 09 09 20 20 20 |hem here|..... |
|00003930| 2a 2f 0d 09 66 6f 72 20 | 28 63 6f 75 6e 74 20 3d |*/..for |(count =|
|00003940| 20 30 3b 20 63 6f 75 6e | 74 20 3c 3d 20 32 3b 20 | 0; coun|t <= 2; |
|00003950| 63 6f 75 6e 74 2b 2b 29 | 20 7b 0d 09 09 64 75 6d |count++)| {...dum|
|00003960| 6d 79 48 61 6e 64 6c 65 | 20 3d 20 47 65 74 31 52 |myHandle| = Get1R|
|00003970| 65 73 6f 75 72 63 65 28 | 70 72 65 66 65 72 72 65 |esource(|preferre|
|00003980| 64 54 79 70 65 73 5b 63 | 6f 75 6e 74 5d 2c 20 72 |dTypes[c|ount], r|
|00003990| 65 73 49 44 29 3b 0d 09 | 09 69 66 20 28 64 75 6d |esID);..|.if (dum|
|000039a0| 6d 79 48 61 6e 64 6c 65 | 20 21 3d 20 4e 55 4c 4c |myHandle| != NULL|
|000039b0| 29 20 7b 0d 09 09 09 2f | 2a 20 54 68 69 73 20 72 |) {..../|* This r|
|000039c0| 65 73 6f 75 72 63 65 20 | 65 78 69 73 74 73 2c 20 |esource |exists, |
|000039d0| 73 6f 20 72 65 74 75 72 | 6e 20 69 74 73 20 74 79 |so retur|n its ty|
|000039e0| 70 65 20 63 6f 64 65 20 | 2a 2f 0d 09 09 09 2a 62 |pe code |*/....*b|
|000039f0| 65 73 74 54 79 70 65 20 | 3d 20 70 72 65 66 65 72 |estType |= prefer|
|00003a00| 72 65 64 54 79 70 65 73 | 5b 63 6f 75 6e 74 5d 3b |redTypes|[count];|
|00003a10| 0d 09 09 09 53 65 74 52 | 65 73 4c 6f 61 64 28 74 |....SetR|esLoad(t|
|00003a20| 72 75 65 29 3b 0d 09 09 | 09 72 65 74 75 72 6e 20 |rue);...|.return |
|00003a30| 6e 6f 45 72 72 3b 0d 09 | 09 7d 0d 09 7d 0d 09 53 |noErr;..|.}..}..S|
|00003a40| 65 74 52 65 73 4c 6f 61 | 64 28 74 72 75 65 29 3b |etResLoa|d(true);|
|00003a50| 0d 09 0d 09 2f 2a 20 49 | 66 20 74 68 65 20 61 62 |..../* I|f the ab|
|00003a60| 6f 76 65 20 74 65 73 74 | 20 66 61 69 6c 73 2c 20 |ove test| fails, |
|00003a70| 74 68 65 6e 20 77 65 20 | 64 6f 6e 27 74 20 68 61 |then we |don't ha|
|00003a80| 76 65 20 61 20 72 65 63 | 6f 67 6e 69 7a 65 64 20 |ve a rec|ognized |
|00003a90| 74 79 70 65 2c 20 73 6f | 20 77 65 27 6c 6c 20 2a |type, so| we'll *|
|00003aa0| 2f 0d 09 2f 2a 20 74 61 | 6b 65 20 74 68 65 20 66 |/../* ta|ke the f|
|00003ab0| 69 72 73 74 20 74 79 70 | 65 20 77 65 20 63 61 6e |irst typ|e we can|
|00003ac0| 20 67 65 74 2e 09 09 09 | 09 09 09 09 09 09 09 20 | get....|....... |
|00003ad0| 20 20 2a 2f 0d 09 73 63 | 72 61 74 63 68 20 3d 20 | */..sc|ratch = |
|00003ae0| 31 3b 0d 09 72 65 74 75 | 72 6e 20 47 65 74 41 6c |1;..retu|rn GetAl|
|00003af0| 6c 54 79 70 65 73 28 65 | 6e 74 72 79 4e 75 6d 2c |lTypes(e|ntryNum,|
|00003b00| 20 26 73 63 72 61 74 63 | 68 2c 20 62 65 73 74 54 | &scratc|h, bestT|
|00003b10| 79 70 65 29 3b 0d 7d 0d | 0d 2f 2a 20 47 65 74 20 |ype);.}.|./* Get |
|00003b20| 61 20 6c 69 73 74 20 6f | 66 20 61 6c 6c 20 6f 66 |a list o|f all of|
|00003b30| 20 74 68 65 20 72 65 73 | 6f 75 72 63 65 20 74 79 | the res|ource ty|
|00003b40| 70 65 73 20 63 6f 6e 74 | 61 69 6e 65 64 20 69 6e |pes cont|ained in|
|00003b50| 20 65 6e 74 72 79 20 22 | 65 6e 74 72 79 4e 75 6d | entry "|entryNum|
|00003b60| 22 20 2a 2f 0d 2f 2a 20 | 4f 6e 20 65 6e 74 72 79 |" */./* |On entry|
|00003b70| 2c 20 74 79 70 65 4c 69 | 73 74 20 69 73 20 74 68 |, typeLi|st is th|
|00003b80| 65 20 61 64 64 72 65 73 | 73 20 6f 66 20 61 6e 20 |e addres|s of an |
|00003b90| 61 72 72 61 79 20 6f 66 | 20 72 65 73 6f 75 72 63 |array of| resourc|
|00003ba0| 65 20 74 79 70 65 73 2c | 20 61 6e 64 20 20 2a 2f |e types,| and */|
|00003bb0| 0d 2f 2a 20 6e 75 6d 53 | 6c 6f 74 73 20 69 73 20 |./* numS|lots is |
|00003bc0| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 6f 70 |the numb|er of op|
|00003bd0| 65 6e 69 6e 67 73 20 69 | 6e 20 74 68 61 74 20 61 |enings i|n that a|
|00003be0| 72 72 61 79 2e 20 4f 6e | 20 65 78 69 74 2c 20 6e |rray. On| exit, n|
|00003bf0| 75 6d 53 6c 6f 74 73 09 | 20 2a 2f 0d 2f 2a 20 69 |umSlots.| */./* i|
|00003c00| 73 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |s the nu|mber of |
|00003c10| 74 79 70 65 20 63 6f 64 | 65 73 20 74 68 61 74 20 |type cod|es that |
|00003c20| 77 65 72 65 20 70 6c 61 | 63 65 64 20 69 6e 20 74 |were pla|ced in t|
|00003c30| 68 65 20 61 72 72 61 79 | 2e 09 09 09 20 2a 2f 0d |he array|.... */.|
|00003c40| 0d 4f 53 45 72 72 09 47 | 65 74 41 6c 6c 54 79 70 |.OSErr.G|etAllTyp|
|00003c50| 65 73 28 73 68 6f 72 74 | 20 65 6e 74 72 79 4e 75 |es(short| entryNu|
|00003c60| 6d 2c 20 73 68 6f 72 74 | 20 2a 6e 75 6d 53 6c 6f |m, short| *numSlo|
|00003c70| 74 73 2c 20 52 65 73 54 | 79 70 65 20 2a 74 79 70 |ts, ResT|ype *typ|
|00003c80| 65 4c 69 73 74 29 0d 7b | 0d 09 73 68 6f 72 74 09 |eList).{|..short.|
|00003c90| 09 6c 61 73 74 53 6c 6f | 74 20 3d 20 2a 6e 75 6d |.lastSlo|t = *num|
|00003ca0| 53 6c 6f 74 73 3b 0d 09 | 4f 53 45 72 72 09 09 65 |Slots;..|OSErr..e|
|00003cb0| 72 72 3b 0d 09 73 68 6f | 72 74 09 09 73 63 72 61 |rr;..sho|rt..scra|
|00003cc0| 70 49 6e 64 65 78 2c 20 | 72 65 73 49 44 3b 0d 09 |pIndex, |resID;..|
|00003cd0| 73 68 6f 72 74 09 09 6e | 75 6d 54 79 70 65 73 2c |short..n|umTypes,|
|00003ce0| 20 74 79 70 65 43 6f 75 | 6e 74 3b 0d 09 52 65 73 | typeCou|nt;..Res|
|00003cf0| 54 79 70 65 09 09 74 79 | 70 65 43 6f 64 65 3b 0d |Type..ty|peCode;.|
|00003d00| 09 48 61 6e 64 6c 65 09 | 09 64 75 6d 6d 79 48 61 |.Handle.|.dummyHa|
|00003d10| 6e 64 6c 65 3b 0d 09 0d | 09 2a 6e 75 6d 53 6c 6f |ndle;...|.*numSlo|
|00003d20| 74 73 20 3d 20 30 3b 0d | 09 65 72 72 20 3d 20 5f |ts = 0;.|.err = _|
|00003d30| 45 6e 74 72 79 54 6f 53 | 63 72 61 70 49 6e 64 65 |EntryToS|crapInde|
|00003d40| 78 28 65 6e 74 72 79 4e | 75 6d 2c 20 26 73 63 72 |x(entryN|um, &scr|
|00003d50| 61 70 49 6e 64 65 78 2c | 20 26 72 65 73 49 44 29 |apIndex,| &resID)|
|00003d60| 3b 0d 09 69 66 20 28 65 | 72 72 20 21 3d 20 6e 6f |;..if (e|rr != no|
|00003d70| 45 72 72 29 20 72 65 74 | 75 72 6e 20 65 72 72 3b |Err) ret|urn err;|
|00003d80| 0d 0d 09 6e 75 6d 54 79 | 70 65 73 20 3d 20 43 6f |...numTy|pes = Co|
|00003d90| 75 6e 74 54 79 70 65 73 | 28 29 3b 0d 09 53 65 74 |untTypes|();..Set|
|00003da0| 52 65 73 4c 6f 61 64 28 | 66 61 6c 73 65 29 3b 09 |ResLoad(|false);.|
|00003db0| 2f 2a 20 57 65 20 6f 6e | 6c 79 20 77 61 6e 74 20 |/* We on|ly want |
|00003dc0| 74 6f 20 6b 6e 6f 77 20 | 69 66 20 70 61 72 74 69 |to know |if parti|
|00003dd0| 63 75 6c 61 72 20 72 65 | 73 6f 75 72 63 65 73 20 |cular re|sources |
|00003de0| 65 78 69 73 74 2c 20 2a | 2f 0d 09 09 09 09 09 09 |exist, *|/.......|
|00003df0| 2f 2a 20 62 75 74 20 77 | 65 20 64 6f 6e 27 74 20 |/* but w|e don't |
|00003e00| 77 61 6e 74 20 74 6f 20 | 6c 6f 61 64 20 74 68 65 |want to |load the|
|00003e10| 6d 20 68 65 72 65 2e 09 | 09 09 09 20 20 20 2a 2f |m here..|... */|
|00003e20| 0d 09 66 6f 72 20 28 74 | 79 70 65 43 6f 75 6e 74 |..for (t|ypeCount|
|00003e30| 20 3d 20 31 3b 20 74 79 | 70 65 43 6f 75 6e 74 20 | = 1; ty|peCount |
|00003e40| 3c 3d 20 6e 75 6d 54 79 | 70 65 73 3b 20 74 79 70 |<= numTy|pes; typ|
|00003e50| 65 43 6f 75 6e 74 2b 2b | 29 20 7b 0d 09 09 47 65 |eCount++|) {...Ge|
|00003e60| 74 31 49 6e 64 54 79 70 | 65 28 26 74 79 70 65 43 |t1IndTyp|e(&typeC|
|00003e70| 6f 64 65 2c 20 74 79 70 | 65 43 6f 75 6e 74 29 3b |ode, typ|eCount);|
|00003e80| 0d 09 09 69 66 20 28 28 | 65 72 72 20 3d 20 52 65 |...if ((|err = Re|
|00003e90| 73 45 72 72 6f 72 28 29 | 29 20 21 3d 20 6e 6f 45 |sError()|) != noE|
|00003ea0| 72 72 29 20 62 72 65 61 | 6b 3b 0d 09 09 64 75 6d |rr) brea|k;...dum|
|00003eb0| 6d 79 48 61 6e 64 6c 65 | 20 3d 20 47 65 74 31 52 |myHandle| = Get1R|
|00003ec0| 65 73 6f 75 72 63 65 28 | 74 79 70 65 43 6f 64 65 |esource(|typeCode|
|00003ed0| 2c 20 72 65 73 49 44 29 | 3b 0d 09 09 69 66 20 28 |, resID)|;...if (|
|00003ee0| 64 75 6d 6d 79 48 61 6e | 64 6c 65 20 21 3d 20 4e |dummyHan|dle != N|
|00003ef0| 55 4c 4c 29 20 7b 0d 09 | 09 09 2f 2a 20 54 68 69 |ULL) {..|../* Thi|
|00003f00| 73 20 72 65 73 6f 75 72 | 63 65 20 65 78 69 73 74 |s resour|ce exist|
|00003f10| 73 2c 20 73 6f 20 61 64 | 64 20 69 74 20 74 6f 20 |s, so ad|d it to |
|00003f20| 74 68 65 20 6c 69 73 74 | 20 2a 2f 0d 09 09 09 74 |the list| */....t|
|00003f30| 79 70 65 4c 69 73 74 5b | 2a 6e 75 6d 53 6c 6f 74 |ypeList[|*numSlot|
|00003f40| 73 5d 20 3d 20 74 79 70 | 65 43 6f 64 65 3b 0d 09 |s] = typ|eCode;..|
|00003f50| 09 09 2b 2b 28 2a 6e 75 | 6d 53 6c 6f 74 73 29 3b |..++(*nu|mSlots);|
|00003f60| 0d 09 09 09 69 66 20 28 | 2a 6e 75 6d 53 6c 6f 74 |....if (|*numSlot|
|00003f70| 73 20 3e 3d 20 6c 61 73 | 74 53 6c 6f 74 29 20 62 |s >= las|tSlot) b|
|00003f80| 72 65 61 6b 3b 09 2f 2a | 20 45 78 69 74 20 74 68 |reak;./*| Exit th|
|00003f90| 69 73 20 6c 6f 6f 70 20 | 2a 2f 0d 09 09 7d 0d 09 |is loop |*/...}..|
|00003fa0| 7d 0d 09 53 65 74 52 65 | 73 4c 6f 61 64 28 74 72 |}..SetRe|sLoad(tr|
|00003fb0| 75 65 29 3b 0d 09 09 0d | 09 72 65 74 75 72 6e 20 |ue);....|.return |
|00003fc0| 65 72 72 3b 0d 7d 0d 0d | 09 0d 00 00 00 00 00 00 |err;.}..|........|
|00003fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004000| 00 00 01 00 00 00 02 fa | 00 00 01 fa 00 00 00 5a |........|.......Z|
|00004010| 00 00 2d 4a 0d 51 44 4f | 66 66 73 63 72 65 65 6e |..-J.QDO|ffscreen|
|00004020| 2e 68 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.h......|........|
|00004030| 0c 53 63 72 61 70 54 6f | 6f 6c 73 2e 63 3e 02 00 |.ScrapTo|ols.c>..|
|00004040| 00 00 54 45 58 54 4b 41 | 48 4c 01 00 00 96 00 c9 |..TEXTKA|HL......|
|00004050| 00 00 54 45 58 54 4b 41 | 48 4c 01 00 00 96 00 c9 |..TEXTKA|HL......|
|00004060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004070| 00 00 a5 d5 0c b1 00 00 | 3f 4a 00 00 03 54 00 00 |........|?J...T..|
|00004080| 00 00 00 00 00 00 00 00 | 00 00 06 3e 25 00 00 00 |........|...>%...|
|00004090| 2d 4a 07 53 6f 75 6e 64 | 2e 68 00 00 00 00 00 00 |-J.Sound|.h......|
|000040a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000040b0| 00 00 00 00 06 3f 25 00 | 00 00 2d 4a 08 53 79 73 |.....?%.|..-J.Sys|
|000040c0| 45 71 75 2e 68 00 00 00 | 00 00 00 00 00 00 00 00 |Equ.h...|........|
|000040d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 06 40 |........|.......@|
|000040e0| 25 00 00 00 2d 4a 07 54 | 69 6d 65 72 2e 68 00 00 |%...-J.T|imer.h..|
|000040f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004100| 00 00 00 28 00 00 34 3f | 01 86 00 00 00 00 00 00 |...(..4?|........|
|00004110| 28 68 01 2d 00 00 00 00 | 00 00 29 77 01 3a 00 00 |(h.-....|..)w.:..|
|00004120| 00 00 00 00 27 a0 01 25 | 00 00 00 00 00 00 00 62 |....'..%|.......b|
|00004130| 00 03 00 32 00 00 17 ab | 00 ae 00 fd 8d 60 80 00 |...2....|.....`..|
|00004140| 01 41 03 60 01 b3 04 6c | 94 20 00 00 00 00 00 01 |.A.`...l|. ......|
|00004150| 00 00 00 04 0f 2a 65 6e | 74 72 79 43 6f 6e 74 65 |.....*en|tryConte|
|00004160| 6e 74 73 20 00 1c 00 00 | 17 ab 00 ae 00 fd 8c f0 |nts ....|........|
|00004170| 00 00 0d 65 6e 74 72 79 | 43 6f 6e 74 65 6e 74 73 |...entry|Contents|
|00004180| 00 12 00 00 17 1a 00 aa | 00 fd 8c e0 00 00 03 65 |........|.......e|
|00004190| 72 72 00 00 01 64 00 0d | 00 00 09 3b 00 00 09 50 |rr...d..|...;...P|
|000041a0| 15 43 6f 75 6e 74 53 63 | 72 61 70 62 6f 6f 6b 45 |.CountSc|rapbookE|
|000041b0| 6e 74 72 69 65 73 00 00 | 2a c6 00 00 2a da 15 44 |ntries..|*...*..D|
|000041c0| 65 6c 65 74 65 31 53 63 | 72 61 70 62 6f 6f 6b 45 |elete1Sc|rapbookE|
|000041d0| 6e 74 72 79 00 00 34 f5 | 00 00 34 f5 17 44 65 6c |ntry..4.|..4..Del|
|000041e0| 65 74 65 53 63 72 61 70 | 62 6f 6f 6b 45 6e 74 72 |eteScrap|bookEntr|
|000041f0| 69 65 73 00 00 00 0b 3e | 00 00 0b 4b 13 47 65 74 |ies....>|...K.Get|
|00004200| 31 53 63 72 61 70 62 6f | 6f 6b 45 6e 74 72 79 00 |1Scrapbo|okEntry.|
|00004210| 00 00 3b c7 00 00 3b d2 | 0b 47 65 74 41 6c 6c 54 |..;...;.|.GetAllT|
|00004220| 79 70 65 73 00 00 36 d2 | 00 00 36 dd 0b 47 65 74 |ypes..6.|..6..Get|
|00004230| 42 65 73 74 54 79 70 65 | 00 00 13 c6 00 00 13 c6 |BestType|........|
|00004240| 13 47 65 74 53 63 72 61 | 70 62 6f 6f 6b 45 6e 74 |.GetScra|pbookEnt|
|00004250| 72 69 65 73 00 00 1c cf | 00 00 1c e2 17 49 6e 73 |ries....|.....Ins|
|00004260| 65 72 74 53 63 72 61 70 | 62 6f 6f 6b 45 6e 74 72 |ertScrap|bookEntr|
|00004270| 69 65 73 00 00 00 13 ce | 00 00 13 db 13 50 75 74 |ies.....|.....Put|
|00004280| 31 53 63 72 61 70 62 6f | 6f 6b 45 6e 74 72 79 00 |1Scrapbo|okEntry.|
|00004290| 00 00 1c c8 00 00 1c c8 | 13 50 75 74 53 63 72 61 |........|.PutScra|
|000042a0| 70 62 6f 6f 6b 45 6e 74 | 72 69 65 73 00 00 21 ad |pbookEnt|ries..!.|
|000042b0| 00 00 21 be 11 5f 44 65 | 6c 65 74 65 31 53 63 72 |..!.._De|lete1Scr|
|000042c0| 61 70 49 74 65 6d 00 00 | 00 9e 00 00 00 b0 13 5f |apItem..|......._|
|000042d0| 45 6e 74 72 79 54 6f 53 | 63 72 61 70 49 6e 64 65 |EntryToS|crapInde|
|000042e0| 78 00 00 00 06 59 00 00 | 06 67 0f 5f 47 65 74 31 |x....Y..|.g._Get1|
|000042f0| 53 63 72 61 70 49 74 65 | 6d 00 00 00 01 00 00 00 |ScrapIte|m.......|
|00004300| 02 fa 00 00 01 fa 00 00 | 00 5a 01 06 f5 00 06 9e |........|.Z......|
|00004310| 00 00 00 1c 00 5a 00 02 | 42 4b 50 54 00 00 00 1a |.....Z..|BKPT....|
|00004320| 44 54 56 55 00 00 00 26 | 4d 50 53 52 00 00 00 32 |DTVU...&|MPSR...2|
|00004330| 76 2f ff ff 00 00 00 00 | 00 00 00 00 22 23 ff ff |v/......|...."#..|
|00004340| 00 00 00 2c 00 00 00 00 | 03 ef ff ff 00 00 00 92 |...,....|........|
|00004350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+